/* ============================================================
   Helpdesk Refresh v2 — App styles
   Ported from design_handoff_helpdesk_refresh/design/styles.css.
   Deliberately excluded: Tweaks panel, data-accent swatches, Manrope
   font switch (Inter only ships). Consumes tokens from helpdesk-theme.css.
   ============================================================ */

/* Density variables set on body */
body {
  --row-py: 10px;
  --card-p: 16px;
  --gap: 12px;
  --nav-py: 6px;
  --chip-py: 4px;
}
body.density-comfortable {
  --row-py: 14px;
  --card-p: 20px;
  --gap: 16px;
  --nav-py: 8px;
  --chip-py: 6px;
}

/* ============================================================
   Shell (v2)
   The v2 shell uses class .hdx-shell to avoid conflict with the
   existing .shell in /styles/layout.css. Routes that opt into the
   refresh render <div class="hdx-shell">. MainLayout wraps every
   page in this shell.
   ============================================================ */
.hdx-shell {
  display: grid;
  grid-template-columns: var(--shell-sidebar-width, 240px) 1fr;
  grid-template-rows: var(--shell-topbar-height, 56px) 1fr;
  height: 100vh;
  width: 100vw;
  background: var(--color-bg-base);
  overflow: hidden;
}

.hdx-sidebar {
  background: var(--color-bg-surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  grid-row: 1 / -1;
  border-right: 1px solid var(--color-border);
}

.hdx-sidebar__brand {
  height: var(--shell-topbar-height, 56px);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-tile {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--accent-raw);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.2);
}
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; color: var(--color-text-primary); }
.brand-sub { font-size: 10px; color: var(--color-text-muted); font-weight: 500; }

.hdx-sidebar__nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }

.hdx-nav-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: 14px 10px 4px;
}

.hdx-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--nav-py) 10px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
  margin-bottom: 1px;
  transition: background 120ms var(--ease-out), color 120ms var(--ease-out);
  text-decoration: none;
  font-family: inherit;
  font-weight: 500;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
}
.hdx-nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.hdx-nav-item:hover { background: var(--color-bg-elevated); color: var(--color-text-primary); }
.hdx-nav-item.active {
  background: var(--accent-raw);
  color: white;
  font-weight: 600;
}
.hdx-nav-item.active:hover { background: var(--accent-raw); color: white; }
.hdx-nav-item .count {
  margin-left: auto;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
}
.hdx-nav-item.active .count { background: oklch(1 0 0 / 0.22); color: white; }

.hdx-sidebar__footer {
  padding: 10px 12px;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.hdx-sidebar__user { flex: 1; min-width: 0; }
.hdx-sidebar__user-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--color-text-primary); }
.hdx-sidebar__user-role { font-size: 10.5px; color: var(--color-text-muted); }

/* ============================================================
   Topbar
   ============================================================ */
.hdx-topbar {
  grid-column: 2 / -1;
  background: var(--color-bg-surface);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  border-bottom: 1px solid var(--color-border);
  position: relative;
  z-index: 10;
}
.hdx-topbar__search {
  flex: 1;
  max-width: 520px;
  height: 34px;
  background: var(--color-bg-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 150ms var(--ease-out);
}
.hdx-topbar__search:hover { border-color: var(--accent-raw); color: var(--color-text-primary); }
.hdx-topbar__search .kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  background: var(--color-bg-elevated);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
}

.hdx-topbar__right { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.hdx-icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 150ms var(--ease-out), color 150ms var(--ease-out);
  position: relative;
}
.hdx-icon-btn:hover { background: var(--color-bg-elevated); color: var(--color-text-primary); }
.hdx-icon-btn svg { width: 16px; height: 16px; }

/* ============================================================
   Avatar (gradient-on-hue)
   ============================================================ */
.hdx-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px; color: white;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, oklch(0.55 0.14 280), oklch(0.65 0.16 240));
}
.hdx-avatar.sm { width: 20px; height: 20px; font-size: 9px; }
.hdx-avatar.md { width: 32px; height: 32px; font-size: 11px; }
.hdx-avatar.lg { width: 40px; height: 40px; font-size: 13px; }

/* ============================================================
   Main content
   ============================================================ */
.hdx-main {
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--color-bg-base);
  padding: 24px 28px 48px;
  position: relative;
}
.hdx-main.full-bleed { padding: 0; }

.hdx-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 20px;
}
.hdx-page-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.2;
  margin: 0 0 6px;
  color: var(--color-text-primary);
}
.hdx-page-title .fw-light { color: var(--color-text-muted); font-weight: 300; }
.hdx-page-sub { font-size: 13px; color: var(--color-text-muted); margin: 0; }

/* ============================================================
   Buttons (v2 primitives — prefixed to avoid shadcn Button conflict)
   ============================================================ */
.hdx-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 120ms var(--ease-out), color 120ms var(--ease-out), border-color 120ms var(--ease-out);
  white-space: nowrap;
  color: var(--color-text-primary);
  background: transparent;
}
.hdx-btn svg { width: 14px; height: 14px; }
.hdx-btn--primary {
  background: var(--accent-raw);
  color: white;
}
.hdx-btn--primary:hover {
  background: color-mix(in oklch, var(--accent-raw) 90%, black);
}
.hdx-btn--secondary {
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}
.hdx-btn--secondary:hover { background: var(--color-bg-elevated); }
.hdx-btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.hdx-btn--ghost:hover { background: var(--color-bg-elevated); color: var(--color-text-primary); }
.hdx-btn--sm { height: 26px; font-size: 12px; padding: 0 9px; }

/* ============================================================
   Cards (prefixed; shadcn Card still available via ~/components/ui/card)
   ============================================================ */
.hdx-card {
  background: var(--color-bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.hdx-card__header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.hdx-card__title { font-size: 14px; font-weight: 600; color: var(--color-text-primary); }
.hdx-card__sub { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.hdx-card__body { padding: var(--card-p); }

/* ============================================================
   Pills / Priority / Tags
   ============================================================ */
.hdx-pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1.4;
}
.hdx-pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.hdx-pill--open     { background: oklch(0.55 0.12 230 / 0.15); color: oklch(0.78 0.12 230); }
.hdx-pill--progress { background: oklch(0.75 0.15 75 / 0.15); color: oklch(0.82 0.15 75); }
.hdx-pill--resolved { background: oklch(0.65 0.15 145 / 0.18); color: oklch(0.80 0.15 145); }
.hdx-pill--closed   { background: oklch(0.50 0.005 230 / 0.25); color: oklch(0.75 0.005 230); }
.hdx-pill--breach   { background: oklch(0.55 0.20 25 / 0.18); color: oklch(0.75 0.20 25); }
.hdx-pill--pending  { background: oklch(0.50 0.07 270 / 0.20); color: oklch(0.78 0.10 270); }

html.light .hdx-pill--open     { color: oklch(0.40 0.14 230); }
html.light .hdx-pill--progress { color: oklch(0.45 0.15 75); }
html.light .hdx-pill--resolved { color: oklch(0.40 0.15 145); }
html.light .hdx-pill--breach   { color: oklch(0.45 0.20 25); }
html.light .hdx-pill--pending  { color: oklch(0.40 0.12 270); }

.hdx-prio {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.hdx-prio::before {
  content: "";
  width: 3px; height: 10px;
  border-radius: 1px;
  background: currentColor;
}
.hdx-prio.urgent { color: oklch(0.65 0.22 15); }
.hdx-prio.normal { color: oklch(0.78 0.15 75); }
.hdx-prio.low    { color: var(--color-text-muted); }

.hdx-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 10.5px;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ============================================================
   Stats grid
   ============================================================ */
.hdx-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.hdx-stat {
  background: var(--color-bg-surface);
  border-radius: var(--radius-xl);
  padding: 16px 18px;
  border: 1px solid var(--color-border);
  position: relative;
  overflow: hidden;
}
.hdx-stat__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hdx-stat__label svg { width: 12px; height: 12px; }
.hdx-stat__value {
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
}
.hdx-stat__delta {
  font-size: 11px;
  margin-top: 4px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.hdx-stat__delta.pos { color: var(--color-status-success); }
.hdx-stat__delta.neg { color: var(--color-status-error); }
.hdx-stat__delta svg { width: 11px; height: 11px; }

.hdx-spark { height: 28px; margin-top: 10px; display: flex; align-items: flex-end; gap: 2px; }
.hdx-spark__bar {
  flex: 1;
  background: var(--accent-raw);
  opacity: 0.35;
  border-radius: 2px 2px 0 0;
  min-height: 2px;
}
.hdx-spark__bar:last-child { opacity: 1; }

/* ============================================================
   Ticket row
   ============================================================ */
.hdx-ticket-list { display: flex; flex-direction: column; }
.hdx-ticket-row {
  display: grid;
  grid-template-columns: 28px 96px minmax(0, 1fr) 110px 120px 80px 70px;
  gap: 14px;
  align-items: center;
  padding: var(--row-py) 18px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms var(--ease-out);
  position: relative;
}
.hdx-ticket-row.no-select { grid-template-columns: 96px minmax(0, 1fr) 110px 120px 80px 70px; }
.hdx-ticket-row:last-child { border-bottom: 0; }
.hdx-ticket-row:hover { background: var(--color-bg-elevated); }
.hdx-ticket-row.selected { background: oklch(from var(--accent-raw) l c h / 0.12); }
.hdx-ticket-row.selected::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: var(--accent-raw);
}

.hdx-tid {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--color-text-muted);
  font-weight: 600;
}
.hdx-tsummary { min-width: 0; }
.hdx-tsummary__title {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-primary);
}
.hdx-tsummary__meta {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 3px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.hdx-tsummary__meta .dot-sep { opacity: 0.5; }

.hdx-assignee-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-primary);
}
.hdx-time-cell {
  font-size: 11px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.hdx-checkbox {
  width: 16px; height: 16px;
  border: 1.5px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-bg-surface);
  transition: border-color 120ms, background 120ms;
  padding: 0;
}
.hdx-checkbox.checked {
  background: var(--accent-raw);
  border-color: var(--accent-raw);
}
.hdx-checkbox.checked svg { width: 10px; height: 10px; color: white; stroke-width: 3; }

/* Filter chips */
.hdx-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.hdx-chip {
  padding: var(--chip-py) 10px;
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--color-text-muted);
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 500;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.hdx-chip:hover { background: var(--color-bg-elevated); color: var(--color-text-primary); }
.hdx-chip.active {
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}
.hdx-chip .count {
  font-size: 10px;
  background: var(--color-bg-base);
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
}

/* Segmented control */
.hdx-seg {
  display: inline-flex;
  padding: 2px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  gap: 2px;
}
.hdx-seg__btn {
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 150ms var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-family: inherit;
}
.hdx-seg__btn:hover { color: var(--color-text-primary); }
.hdx-seg__btn.active {
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.15);
}

/* Bulk bar */
.hdx-bulk-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: color-mix(in oklch, var(--accent-raw) 12%, var(--color-bg-surface));
  border-bottom: 1px solid var(--accent-raw);
  font-size: 12.5px;
  font-weight: 500;
}
.hdx-bulk-bar__count { color: var(--color-text-primary); font-weight: 600; }
.hdx-bulk-bar__actions { margin-left: auto; display: flex; gap: 4px; }

/* ============================================================
   Kanban
   ============================================================ */
.hdx-kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 300px;
  gap: 14px;
  padding: 18px;
  overflow-x: auto;
  height: 100%;
  align-items: start;
}
.hdx-kanban__col {
  background: var(--color-bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--shell-topbar-height, 56px) - 200px);
}
.hdx-kanban__col-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600;
  color: var(--color-text-primary);
}
.hdx-kanban__col-head .count {
  background: var(--color-bg-elevated);
  padding: 1px 8px; border-radius: 999px; font-size: 11px;
  color: var(--color-text-muted);
}
.hdx-kanban__col-head .marker {
  width: 8px; height: 8px; border-radius: 50%;
}
.hdx-kanban__col-body {
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto;
  flex: 1;
}
.hdx-kanban-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  font-size: 12.5px;
  transition: border-color 120ms, transform 120ms;
}
.hdx-kanban-card:hover { border-color: var(--accent-raw); }
.hdx-kanban-card.dragging { opacity: 0.4; }
/* Gentle settle animation when a card lands in a column. */
.hdx-kanban-card { animation: hdxCardIn 200ms var(--ease-out) both; }
@keyframes hdxCardIn {
  from { transform: translateY(-4px) scale(0.99); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.hdx-kanban-card__top {
  display: flex; justify-content: space-between;
  font-size: 10.5px; color: var(--color-text-muted);
  font-family: var(--font-mono); font-weight: 600;
  margin-bottom: 6px;
}
.hdx-kanban-card__title {
  font-size: 12.5px; line-height: 1.45; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--color-text-primary);
}
.hdx-kanban-card__meta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 6px;
}

/* ============================================================
   Ticket detail (two-pane layout)
   ============================================================ */
.hdx-detail-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}
.hdx-detail-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.hdx-detail-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 16px;
}
.hdx-crumbs {
  font-size: 12px; color: var(--color-text-muted);
  margin-bottom: 10px; display: flex; gap: 6px; align-items: center;
}
.hdx-crumbs .sep { opacity: 0.4; }
.hdx-crumbs .current { color: var(--color-text-primary); font-weight: 500; }

.hdx-ticket-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.018em;
  margin: 6px 0 10px;
  line-height: 1.25;
  color: var(--color-text-primary);
}
.hdx-ticket-meta-row {
  display: flex; gap: 14px; align-items: center;
  font-size: 12px; color: var(--color-text-muted);
  margin-bottom: 24px; flex-wrap: wrap;
}
.hdx-ticket-meta-row .dot-sep { opacity: 0.5; }
.hdx-ticket-meta-row strong { color: var(--color-text-primary); font-weight: 600; }

/* Thread */
.hdx-thread { display: flex; flex-direction: column; gap: 16px; }
.hdx-msg { display: flex; gap: 12px; }
.hdx-msg__body {
  flex: 1;
  background: var(--color-bg-surface);
  border-radius: var(--radius-xl);
  padding: 14px 16px;
  border: 1px solid var(--color-border);
}
.hdx-msg.internal .hdx-msg__body {
  background: oklch(0.75 0.15 75 / 0.08);
  border-color: oklch(0.75 0.15 75 / 0.25);
}
.hdx-msg__head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; margin-bottom: 6px; gap: 10px;
}
.hdx-msg__who { font-weight: 600; color: var(--color-text-primary); }
.hdx-msg__internal-flag {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: oklch(0.82 0.15 75); font-weight: 700;
  background: oklch(0.75 0.15 75 / 0.18); padding: 2px 7px;
  border-radius: 3px; margin-left: 8px;
}
.hdx-msg__text { font-size: 13.5px; line-height: 1.65; color: var(--color-text-primary); }
.hdx-msg__text p { margin: 0 0 8px; }
.hdx-msg__text p:last-child { margin-bottom: 0; }

.hdx-composer {
  margin-top: 20px;
  background: var(--color-bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  overflow: hidden;
}
.hdx-composer__tabs { display: flex; border-bottom: 1px solid var(--color-border); }
.hdx-composer__tab {
  padding: 11px 16px;
  font-size: 12.5px;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
  font-family: inherit;
  background: transparent;
  border-top: 0; border-left: 0; border-right: 0;
}
.hdx-composer__tab.active {
  color: var(--color-text-primary);
  border-color: var(--accent-raw);
  font-weight: 600;
}
.hdx-composer__area { padding: 14px; }
.hdx-composer__input {
  width: 100%; min-height: 84px;
  border: 0; background: transparent;
  color: var(--color-text-primary);
  font-family: inherit; font-size: 13px;
  resize: none; outline: none; line-height: 1.6;
}
.hdx-composer__actions {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-top: 1px solid var(--color-border);
  background: var(--color-bg-base);
}

/* Properties panel */
.hdx-prop-section { margin-bottom: 22px; }
.hdx-prop-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--color-text-muted); font-weight: 600; margin-bottom: 8px;
}
.hdx-prop-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; font-size: 12.5px;
}
.hdx-prop-row + .hdx-prop-row { border-top: 1px solid var(--color-border); }
.hdx-prop-row__key { color: var(--color-text-muted); }
.hdx-prop-row__val { font-weight: 500; color: var(--color-text-primary); }
.hdx-prop-row__val.tabular { font-variant-numeric: tabular-nums; }

/* SLA Timeline */
.hdx-sla-timeline {
  padding: 14px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius);
  margin-top: 8px;
}
.hdx-sla-track {
  position: relative;
  height: 6px;
  background: var(--color-bg-base);
  border-radius: 999px;
  overflow: hidden;
  margin: 14px 0 6px;
}
.hdx-sla-track__fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--color-status-success), var(--color-status-warning));
  border-radius: 999px;
}
.hdx-sla-track__marker {
  position: absolute; top: -3px;
  width: 2px; height: 12px; background: var(--color-text-primary);
  transform: translateX(-50%);
}
.hdx-sla-stages {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.hdx-sla-summary {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; margin-bottom: 4px;
}
.hdx-sla-summary__label { color: var(--color-text-muted); }
.hdx-sla-summary__val { font-weight: 600; color: var(--color-text-primary); }
.hdx-sla-summary__val.warn { color: var(--color-status-warning); }

/* Activity timeline */
.hdx-timeline {
  display: flex; flex-direction: column; gap: 14px;
  position: relative; padding-left: 14px;
}
.hdx-timeline::before {
  content: ""; position: absolute;
  left: 3px; top: 4px; bottom: 4px;
  width: 1px; background: var(--color-border);
}
.hdx-tl-item { position: relative; font-size: 12px; color: var(--color-text-primary); }
.hdx-tl-item::before {
  content: ""; position: absolute;
  left: -14px; top: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--color-bg-surface);
  border: 1.5px solid var(--color-text-muted);
}
.hdx-tl-item.success::before {
  border-color: var(--color-status-success);
  background: var(--color-status-success);
}
.hdx-tl-item.accent::before {
  border-color: var(--accent-raw);
  background: var(--accent-raw);
}
.hdx-tl-item__t {
  color: var(--color-text-muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* ============================================================
   Command palette
   ============================================================ */
.hdx-palette-overlay {
  position: fixed; inset: 0;
  background: oklch(0 0 0 / 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  animation: hdxFadeIn 150ms var(--ease-out);
}
@keyframes hdxFadeIn { from { opacity: 0; } to { opacity: 1; } }
.hdx-palette {
  width: 640px;
  max-width: calc(100vw - 40px);
  background: var(--color-bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  animation: hdxScaleIn 180ms var(--ease-out);
}
@keyframes hdxScaleIn {
  from { transform: scale(0.96) translateY(-8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.hdx-palette__search {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
}
.hdx-palette__search svg { width: 16px; height: 16px; color: var(--color-text-muted); }
.hdx-palette__search input {
  flex: 1; background: transparent; border: 0; outline: none;
  color: var(--color-text-primary); font-family: inherit;
  font-size: 15px;
}
.hdx-palette__list {
  max-height: 420px; overflow-y: auto; padding: 6px;
}
.hdx-palette__section-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--color-text-muted); font-weight: 600;
  padding: 10px 12px 4px;
}
.hdx-palette__item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-primary);
}
.hdx-palette__item svg { width: 15px; height: 15px; color: var(--color-text-muted); flex-shrink: 0; }
.hdx-palette__item[aria-selected="true"],
.hdx-palette__item:hover,
.hdx-palette__item.active {
  background: color-mix(in oklch, var(--accent-raw) 15%, var(--color-bg-surface));
}
.hdx-palette__item[aria-selected="true"] svg,
.hdx-palette__item:hover svg,
.hdx-palette__item.active svg { color: var(--color-text-primary); }
.hdx-palette__item .sub { color: var(--color-text-muted); font-size: 11.5px; margin-left: auto; }
.hdx-palette__footer {
  padding: 8px 14px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-base);
  font-size: 11px; color: var(--color-text-muted);
  display: flex; gap: 16px;
}
.hdx-palette__footer .kbd {
  font-family: var(--font-mono);
  background: var(--color-bg-surface);
  padding: 1px 6px; border-radius: 3px;
  border: 1px solid var(--color-border);
  font-size: 10.5px;
}

/* ============================================================
   Side peek
   ============================================================ */
.hdx-peek-overlay {
  position: fixed; inset: 0;
  background: oklch(0 0 0 / 0.35);
  z-index: 80;
  animation: hdxFadeIn 150ms var(--ease-out);
}
.hdx-peek {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 560px;
  max-width: 90vw;
  background: var(--color-bg-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  z-index: 81;
  display: flex;
  flex-direction: column;
  animation: hdxSlideIn 220ms var(--ease-out);
}
@keyframes hdxSlideIn {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.hdx-peek.morphing-out {
  animation: hdxPeekMorphOut 280ms var(--ease-out) both;
}
.hdx-peek-overlay.morphing-out {
  animation: hdxFadeOut 220ms var(--ease-out) both;
}
@keyframes hdxPeekMorphOut {
  from { transform: none; opacity: 1; }
  to   { transform: translateX(24px) scale(0.98); opacity: 0; }
}
@keyframes hdxFadeOut { from { opacity: 1; } to { opacity: 0; } }
.hdx-peek__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 12px;
}
.hdx-peek__body { flex: 1; overflow-y: auto; padding: 20px; }

/* ============================================================
   Smart inbox group
   ============================================================ */
.hdx-smart-group {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 12px;
}
.hdx-smart-group__head {
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  transition: background 120ms;
  border-bottom: 1px solid var(--color-border);
}
.hdx-smart-group__head:hover { background: var(--color-bg-elevated); }
.hdx-smart-group__head.collapsed { border-bottom: 0; }
.hdx-smart-group__badge {
  padding: 2px 8px;
  background: color-mix(in oklch, var(--accent-raw) 20%, transparent);
  color: var(--accent-raw);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: inline-flex; align-items: center; gap: 4px;
}
.hdx-smart-group__title { font-size: 13px; font-weight: 600; color: var(--color-text-primary); }
.hdx-smart-group__sub { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }
.hdx-smart-group__count {
  margin-left: auto;
  font-size: 11px;
  color: var(--color-text-muted);
  display: flex; align-items: center; gap: 10px;
}
.hdx-smart-group__body > .hdx-ticket-row:last-child { border-bottom: 0; }

/* ============================================================
   KB grid + cards
   ============================================================ */
.hdx-kb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.hdx-kb-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 18px;
  cursor: pointer;
  transition: border-color 120ms, transform 120ms;
  color: var(--color-text-primary);
  text-decoration: none;
  display: block;
}
.hdx-kb-card:hover { border-color: var(--accent-raw); }
.hdx-kb-card__icon {
  width: 34px; height: 34px;
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--accent-raw) 15%, var(--color-bg-elevated));
  color: var(--accent-raw);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.hdx-kb-card__title { font-size: 14px; font-weight: 600; margin-bottom: 4px; color: var(--color-text-primary); }
.hdx-kb-card__sub { font-size: 12px; color: var(--color-text-muted); line-height: 1.5; }
.hdx-kb-card__meta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
  font-size: 11px; color: var(--color-text-muted);
  display: flex; justify-content: space-between;
}

/* ============================================================
   Analytics grid
   ============================================================ */
.hdx-analytics-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.hdx-analytics-grid .card--span-4 { grid-column: span 4; }
.hdx-analytics-grid .card--span-6 { grid-column: span 6; }
.hdx-analytics-grid .card--span-8 { grid-column: span 8; }
.hdx-analytics-grid .card--span-12 { grid-column: span 12; }

/* Keyboard-shortcut hint */
.hdx-kbd-hint {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; color: var(--color-text-muted);
}
.hdx-kbd-hint .kbd {
  font-family: var(--font-mono);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10.5px;
  color: var(--color-text-primary);
}

/* Eyebrow helper */
.hdx-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

/* ============================================================
   Split view (queue list + detail pane)
   Active when the queue URL has ?focus=:id. List collapses to the
   left rail, detail grows in from the right.
   ============================================================ */
.hdx-split {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  transition: grid-template-columns 220ms var(--ease-out);
}
.hdx-split__list {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 12px);
  overflow-y: auto;
  background: var(--color-bg-surface);
  min-width: 0;
  max-height: calc(100vh - var(--shell-topbar-height, 56px) - 180px);
}
.hdx-split__listhead {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-surface);
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hdx-split__listhead-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--color-text-primary);
}
.hdx-split__listhead-sub {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.hdx-split__detail {
  overflow-y: auto;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 12px);
  padding: 24px 28px 32px;
  min-width: 0;
  animation: hdxSplitDetailIn 420ms var(--ease-out) both;
  transform-origin: top right;
}
.hdx-split__list.entering {
  animation: hdxSplitListIn 380ms var(--ease-out) both;
}
@keyframes hdxSplitListIn {
  from { transform: translateX(-24px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@keyframes hdxSplitDetailIn {
  from { transform: translateX(24px) scale(0.985); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.hdx-split-card {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 120ms var(--ease-out);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hdx-split-card:hover { background: var(--color-bg-elevated); }
.hdx-split-card.selected {
  background: color-mix(in oklch, var(--accent-raw) 10%, var(--color-bg-surface));
}
.hdx-split-card.selected::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: var(--accent-raw);
}
.hdx-split-card__top {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10.5px; color: var(--color-text-muted);
  font-family: var(--font-mono); font-weight: 600;
}
.hdx-split-card__title {
  font-size: 12.5px; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--color-text-primary);
}
.hdx-split-card__bottom {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--color-text-muted);
}

/* ============================================================
   Peek → detail morph
   ============================================================ */
.hdx-morph-enter { opacity: 1; }
.hdx-morph-enter.is-entering {
  animation: hdxMorphEnter 280ms var(--ease-out) both;
  transform-origin: top right;
}
@keyframes hdxMorphEnter {
  from { transform: translateX(18px) scale(0.985); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* Responsive squeeze */
@media (max-width: 1100px) {
  .hdx-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .hdx-analytics-grid .card--span-4 { grid-column: span 6; }
  .hdx-analytics-grid .card--span-6 { grid-column: span 12; }
  .hdx-analytics-grid .card--span-8 { grid-column: span 12; }
  .hdx-kb-grid { grid-template-columns: repeat(2, 1fr); }
  .hdx-detail-layout { grid-template-columns: 1fr 320px; }
}

@media (max-width: 900px) {
  .hdx-detail-layout {
    grid-template-columns: 1fr;
  }
  .hdx-detail-side {
    position: static;
  }
}
