/**
 * Knoxed Work — Linear-style design system
 * Phase 1 shell: sidebar + list + detail + board
 */

/* ── Design tokens ─────────────────────────────────────────────── */

:root {
  --wk-bg: #0f0f10;
  --wk-panel: #161618;
  --wk-panel-2: #1c1c1f;
  --wk-line: var(--wk-surface-2);
  --wk-line-strong: var(--wk-surface-3);
  --wk-text: #ececee;
  --wk-mute: #8b8b93;
  --wk-mute-2: #6b6b73;
  --wk-accent: #5e6ad2;
  --wk-accent-hover: #6d77e6;
  --wk-accent-soft: rgba(94, 106, 210, 0.15);
  --wk-ok: #4cb782;
  --wk-warn: #f2c94c;
  --wk-fail: #eb5757;
  --wk-sidebar-w: 220px;
  --wk-detail-w: min(480px, 42vw);
  --wk-topbar-h: 44px;
  --wk-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --wk-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --wk-radius: 6px;
  --wk-radius-lg: 8px;
  --wk-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --wk-transition: 120ms ease;
  --wk-surface-0: rgba(255, 255, 255, 0.03);
  --wk-surface-1: rgba(255, 255, 255, 0.05);
  --wk-surface-2: rgba(255, 255, 255, 0.08);
  --wk-surface-3: rgba(255, 255, 255, 0.12);

  /* Aliases for work-card-panel.php partial (inherits parent vars) */
  --bg: var(--wk-bg);
  --panel: var(--wk-panel);
  --line: var(--wk-line-strong);
  --text: var(--wk-text);
  --mute: var(--wk-mute);
  --accent: var(--wk-accent);
  --ok: var(--wk-ok);
  --warn: var(--wk-warn);
  --fail: var(--wk-fail);
  --info: var(--wk-accent);
  /* Legacy names used by Shopify / inline page styles */
  --card-bg: var(--wk-panel);
  --border: var(--wk-line-strong);
  --muted: var(--wk-mute);
}

/* ── Base reset (work shell only) ──────────────────────────────── */

.work-app,
.work-app *,
.work-app *::before,
.work-app *::after {
  box-sizing: border-box;
}

html:has(.work-app) {
  height: 100%;
}

body:has(.work-app) {
  margin: 0;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.work-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font: 13px/1.45 var(--wk-font);
  background: var(--wk-bg);
  color: var(--wk-text);
}

/* Cap the work-page chain to exactly viewport height so internal scroll
   regions (work-list-scroll, knoxed-sidebar) have a finite parent to shrink
   against — otherwise content leaks up to .knoxed-main and pushes the footer
   below the fold. */
.knoxed-app--work,
.knoxed-app--work .knoxed-shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.knoxed-app--work .knoxed-main--work {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

.work-app a {
  color: var(--wk-accent);
  text-decoration: none;
}

.work-app a:hover {
  color: var(--wk-accent-hover);
}

/* ── Top bar ───────────────────────────────────────────────────── */

.work-topbar {
  flex-shrink: 0;
  height: var(--wk-topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--wk-panel);
  border-bottom: 1px solid var(--wk-line);
  z-index: 10;
}

.work-topbar .brand {
  font-weight: 600;
  font-size: 14px;
  color: var(--wk-text);
  letter-spacing: -0.01em;
}

.work-topbar .brand span {
  color: var(--wk-mute);
  font-weight: 400;
}

.work-topbar .spacer {
  flex: 1;
}

.work-topbar .actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.work-topbar .actions a,
.work-topbar .actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--wk-radius);
  font-size: 12px;
  font-family: inherit;
  color: var(--wk-mute);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--wk-transition), color var(--wk-transition), border-color var(--wk-transition);
}

.work-topbar .actions a:hover,
.work-topbar .actions button:hover {
  background: var(--wk-surface-2);
  color: var(--wk-text);
  text-decoration: none;
}

.work-topbar .actions .btn-primary {
  background: var(--wk-accent);
  color: #fff;
  border-color: transparent;
  font-weight: 500;
}

.work-topbar .actions .btn-primary:hover {
  background: var(--wk-accent-hover);
  color: #fff;
}

.work-topbar kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10px;
  font-family: var(--wk-mono);
  color: var(--wk-mute);
  background: var(--wk-surface-2);
  border: 1px solid var(--wk-line);
  border-radius: 4px;
  line-height: 1.4;
}

/* ── Shell body (sidebar + main) ───────────────────────────────── */

.work-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ── Sidebar (legacy work-sidebar + unified knoxed-sidebar) ───── */

.work-sidebar,
.knoxed-sidebar {
  width: var(--wk-sidebar-w);
  flex-shrink: 0;
  background: var(--wk-panel);
  border-right: 1px solid var(--wk-line);
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.work-sidebar .brand,
.knoxed-brand {
  font-weight: 600;
  font-size: 14px;
  padding: 8px 10px 16px;
  color: var(--wk-text);
  letter-spacing: -0.01em;
}

.work-sidebar .nav-section,
.knoxed-sidebar .nav-section {
  margin-bottom: 16px;
}

.work-sidebar .nav-label,
.knoxed-sidebar .nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--wk-mute-2);
  padding: 4px 10px 6px;
  user-select: none;
}

.work-sidebar a,
.knoxed-sidebar a,
.knoxed-sidebar button.knoxed-search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--wk-radius);
  color: var(--wk-mute);
  text-decoration: none;
  font-size: 13px;
  transition: background var(--wk-transition), color var(--wk-transition);
}

.work-sidebar a:hover,
.knoxed-sidebar a:hover,
.knoxed-sidebar button.knoxed-search-btn:hover {
  background: var(--wk-surface-2);
  color: var(--wk-text);
  text-decoration: none;
}

.work-sidebar a.active,
.knoxed-sidebar a.active {
  background: var(--wk-surface-3);
  color: var(--wk-text);
  font-weight: 500;
}

/* Monochrome stroke icons (B&W via currentColor) */
.wki {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--wk-mute);
}

.work-sidebar a:hover .wki,
.work-sidebar a.active .wki,
.knoxed-sidebar a:hover .wki,
.knoxed-sidebar a.active .wki,
.knoxed-sidebar button:hover .wki {
  color: var(--wk-text);
}

.wki-svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Legacy text/emoji icon slot — force monochrome */
.work-sidebar a .icon,
.knoxed-sidebar a .icon,
header.topnav .icon {
  width: 16px;
  text-align: center;
  font-size: 12px;
  opacity: 0.85;
  flex-shrink: 0;
  color: var(--wk-mute);
  filter: grayscale(1);
}

.work-meta-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--wk-mute);
}

.work-meta-icon .wki {
  width: 12px;
  height: 12px;
}

.work-meta-icon .wki-svg {
  width: 11px;
  height: 11px;
}

.wki-lg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--wk-mute);
}

.wki-lg .wki {
  width: 48px;
  height: 48px;
}

.wki-lg .wki-svg {
  width: 40px;
  height: 40px;
  stroke-width: 1.25;
}

.nav-dropdown a .wki,
header.topnav > a .wki {
  color: var(--wk-mute);
}

.nav-dropdown a:hover .wki,
.nav-dropdown a.active .wki,
header.topnav > a:hover .wki {
  color: var(--wk-text);
}

.wk-page-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.wk-notif-kind {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wk-mute);
}

.work-sidebar .badge,
.knoxed-sidebar .badge {
  margin-left: auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  background: var(--wk-surface-3);
  color: var(--wk-mute);
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.work-sidebar a.active .badge,
.knoxed-sidebar a.active .badge {
  background: var(--wk-accent-soft);
  color: var(--wk-accent);
}

.work-sidebar .sep,
.knoxed-sidebar .sep {
  height: 1px;
  background: var(--wk-line);
  margin: 8px 10px;
}

.work-sidebar .nav-footer,
.knoxed-sidebar .nav-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--wk-line);
}

/* ── Main area ─────────────────────────────────────────────────── */

.work-main {
  flex: 1;
  display: flex;
  min-width: 0;
  min-height: 0;
}

/* ── Issue list ────────────────────────────────────────────────── */

.work-list {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--wk-line);
  background: var(--wk-bg);
}

.work-list-header {
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--wk-line);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--wk-bg);
}

.work-list-header h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.work-list-header .count {
  font-size: 12px;
  color: var(--wk-mute);
  font-weight: 400;
}

.work-saved-views {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.work-sv-select {
  font: inherit;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--wk-radius);
  border: 1px solid var(--wk-line);
  background: var(--wk-panel);
  color: var(--wk-text);
  max-width: 140px;
}

.work-sv-save,
.work-btn-ghost,
.work-btn-ghost-sm {
  font: inherit;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--wk-radius);
  border: 1px solid var(--wk-line);
  background: transparent;
  color: var(--wk-mute);
  cursor: pointer;
}

.work-sv-save:hover,
.work-btn-ghost:hover,
.work-btn-ghost-sm:hover {
  color: var(--wk-text);
  border-color: var(--wk-accent);
}

.work-assignee-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.work-assignee-row input {
  flex: 1;
}

.work-list-header .search-wrap {
  flex: 1;
  max-width: 280px;
  margin-left: auto;
  position: relative;
}

.work-list-header input[type="search"],
.work-list-header .work-search {
  width: 100%;
  padding: 6px 10px 6px 28px;
  font: inherit;
  font-size: 12px;
  color: var(--wk-text);
  background: var(--wk-panel);
  border: 1px solid var(--wk-line);
  border-radius: var(--wk-radius);
  outline: none;
  transition: border-color var(--wk-transition), box-shadow var(--wk-transition);
}

.work-list-header input[type="search"]::placeholder {
  color: var(--wk-mute-2);
}

.work-list-header input[type="search"]:focus {
  border-color: rgba(94, 106, 210, 0.5);
  box-shadow: 0 0 0 2px var(--wk-accent-soft);
}

.work-list-header .search-wrap::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--wk-mute-2);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: inset -3px -3px 0 -1px var(--wk-mute-2);
}

.board-search-wrap {
  flex: 1;
  min-width: 160px;
  max-width: 240px;
  margin-right: 8px;
}

.work-sidebar .work-search-trigger,
.knoxed-sidebar .knoxed-search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 4px;
  font: inherit;
  font-size: 13px;
  color: var(--wk-mute);
  background: var(--wk-surface-1);
  border: 1px solid var(--wk-line);
  border-radius: var(--wk-radius);
  cursor: pointer;
  text-align: left;
}

.work-sidebar .work-search-trigger:hover,
.knoxed-sidebar .knoxed-search-btn:hover {
  color: var(--wk-text);
  background: var(--wk-surface-3);
}

.work-kbd {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--wk-mono, ui-monospace, monospace);
  color: var(--wk-mute-2);
  padding: 1px 5px;
  border: 1px solid var(--wk-line);
  border-radius: 4px;
}

/* Cmd+K overlay (infra + work shells) */
.ck-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  background: rgba(0, 0, 0, 0.6);
}

.ck-panel {
  width: 560px;
  max-width: 95vw;
  background: var(--wk-panel, var(--panel));
  border: 1px solid var(--wk-line, var(--line));
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.ck-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--wk-line, var(--line));
}

.ck-head input {
  flex: 1;
  background: none;
  border: 0;
  color: var(--wk-text, var(--text));
  font-size: 15px;
  outline: none;
}

.ck-hint {
  font-size: 10px;
  color: var(--wk-mute-2, var(--mute));
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid var(--wk-line, var(--line));
  border-radius: 4px;
}

.ck-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px 0;
}

.ck-foot {
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--wk-line, var(--line));
  font-size: 11px;
  color: var(--wk-mute, var(--mute));
}

.ck-foot a {
  margin-left: auto;
  font-size: 11px;
  color: var(--wk-accent, var(--accent));
  text-decoration: none;
}

header.topnav .nav-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--wk-surface-1);
  border: 1px solid var(--line);
  color: var(--mute);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

header.topnav .nav-search-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* New issue + modal */
.work-btn-new {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--wk-radius);
  border: 1px solid var(--wk-line);
  background: var(--wk-accent-soft);
  color: var(--wk-accent);
  cursor: pointer;
}

.work-btn-new:hover {
  background: rgba(94, 106, 210, 0.25);
}

.work-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 8500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  background: rgba(0, 0, 0, 0.55);
}

.work-modal-overlay[hidden] {
  display: none !important;
}

.work-modal {
  width: 480px;
  max-width: 95vw;
  background: var(--wk-panel);
  border: 1px solid var(--wk-line);
  border-radius: 12px;
  box-shadow: var(--wk-shadow);
}

.work-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--wk-line);
}

.work-modal-head h2 {
  margin: 0;
  font-size: 15px;
}

.work-modal-close {
  background: none;
  border: 0;
  color: var(--wk-mute);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.work-modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.work-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--wk-mute);
}

.work-field input,
.work-field select,
.work-field textarea {
  font: inherit;
  font-size: 13px;
  color: var(--wk-text);
  background: var(--wk-panel-2);
  border: 1px solid var(--wk-line);
  border-radius: var(--wk-radius);
  padding: 6px 8px;
}

.work-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.work-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.work-btn-primary {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--wk-radius);
  background: var(--wk-accent);
  color: #fff;
  cursor: pointer;
}

.work-issue-title:focus {
  outline: 1px solid rgba(94, 106, 210, 0.5);
  background: var(--wk-surface-1);
}

.work-list-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
}

.work-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 24px;
  color: var(--wk-mute);
  font-size: 13px;
  text-align: center;
}

.work-list-empty .icon {
  font-size: 24px;
  opacity: 0.4;
}

/* ── Issue rows ────────────────────────────────────────────────── */

.work-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--wk-line);
  cursor: pointer;
  user-select: none;
  transition: background var(--wk-transition);
  outline: none;
}

.work-row:hover {
  background: var(--wk-surface-0);
}

.work-row:focus-visible {
  background: var(--wk-surface-1);
  box-shadow: inset 2px 0 0 var(--wk-accent);
}

.work-row.selected,
.work-row:focus-visible {
  background: rgba(94, 106, 210, 0.12);
}

.work-row.selected:hover {
  background: rgba(94, 106, 210, 0.16);
}

.work-row .id {
  font-size: 11px;
  font-family: var(--wk-mono);
  color: var(--wk-mute);
  min-width: 36px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.work-row .title {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-row .meta {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--wk-mute);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-row .assignee {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--wk-mute-2);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Status pills ──────────────────────────────────────────────── */

.work-pill {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.4;
}

.work-pill.backlog {
  background: rgba(139, 139, 147, 0.2);
  color: var(--wk-mute);
}

.work-pill.triaged {
  background: rgba(94, 106, 210, 0.25);
  color: var(--wk-accent);
}

.work-pill.in_progress {
  background: rgba(242, 201, 76, 0.2);
  color: var(--wk-warn);
}

.work-pill.blocked {
  background: rgba(235, 87, 87, 0.2);
  color: var(--wk-fail);
}

.work-pill.done {
  background: rgba(76, 183, 130, 0.2);
  color: var(--wk-ok);
}

.work-pill.wontfix {
  background: rgba(139, 139, 147, 0.15);
  color: var(--wk-mute-2);
  text-decoration: line-through;
}

/* Priority dots (optional list adornment) */
.work-pri {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.work-pri.p1 { background: var(--wk-fail); }
.work-pri.p2 { background: var(--wk-warn); }
.work-pri.p3 { background: var(--wk-accent); }
.work-pri.p4 { background: var(--wk-mute-2); }

/* ── Detail pane ───────────────────────────────────────────────── */

.work-detail {
  width: var(--wk-detail-w);
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--wk-panel);
  min-height: 0;
}

.work-detail:not(.empty) {
  border-left: 2px solid color-mix(in srgb, var(--wk-accent) 35%, var(--wk-line));
}

.work-detail.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wk-mute);
  font-size: 13px;
  text-align: center;
  padding: 24px;
  background: color-mix(in srgb, var(--wk-panel) 92%, var(--wk-bg));
}

.work-detail-hint {
  max-width: 240px;
  line-height: 1.45;
}

.work-detail-hint strong {
  display: block;
  font-size: 14px;
  color: var(--wk-text);
  margin-bottom: 8px;
}

.work-detail-hint p {
  margin: 0;
  font-size: 12px;
  color: var(--wk-mute);
}

.work-detail-hint kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--wk-line);
  background: var(--wk-surface-1);
}

/* Detail pane: style injected panel content */
.work-detail .pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.work-detail .pill-secondary { background: rgba(139, 139, 147, 0.2); color: var(--wk-mute); }
.work-detail .pill-info     { background: rgba(94, 106, 210, 0.25); color: var(--wk-accent); }
.work-detail .pill-warn     { background: rgba(242, 201, 76, 0.2); color: var(--wk-warn); }
.work-detail .pill-fail     { background: rgba(235, 87, 87, 0.2); color: var(--wk-fail); }
.work-detail .pill-ok       { background: rgba(76, 183, 130, 0.2); color: var(--wk-ok); }

.work-detail input,
.work-detail select,
.work-detail textarea {
  font: inherit;
  font-size: 12px;
  color: var(--wk-text);
  background: var(--wk-bg);
  border: 1px solid var(--wk-line-strong);
  border-radius: var(--wk-radius);
  padding: 4px 8px;
}

.work-detail input:focus,
.work-detail select:focus,
.work-detail textarea:focus {
  outline: none;
  border-color: rgba(94, 106, 210, 0.5);
  box-shadow: 0 0 0 2px var(--wk-accent-soft);
}

.work-detail button[type="submit"],
.work-detail .btn {
  background: var(--wk-accent);
  color: #fff;
  border: 0;
  padding: 5px 12px;
  border-radius: var(--wk-radius);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--wk-transition);
}

.work-detail button[type="submit"]:hover {
  background: var(--wk-accent-hover);
}

/* ── Kanban board ──────────────────────────────────────────────── */

/* Board uses full main width until an issue is opened in the detail pane */
.work-main--board .work-detail.empty,
.work-body[data-view="board"] .work-detail.empty {
  display: none;
  width: 0;
  min-width: 0;
  padding: 0;
  border: none;
  overflow: hidden;
}

.work-main--board .work-list,
.work-body[data-view="board"] .work-list {
  flex: 1;
  max-width: 100%;
  border-right: none;
}

.work-main--board .work-list-scroll,
.work-body[data-view="board"] .work-list-scroll {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.work-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  padding: 16px;
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.work-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 120px;
}

.work-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
  padding: 5px 0;
  border-bottom: 2px solid var(--wk-line);
  user-select: none;
}

.work-col-header .label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.work-col-header .count {
  font-weight: 400;
  color: var(--wk-mute);
  font-variant-numeric: tabular-nums;
}

/* Column accent colors */
.work-col[data-status="backlog"]     .work-col-header { color: var(--wk-mute); border-bottom-color: var(--wk-mute); }
.work-col[data-status="triaged"]     .work-col-header { color: var(--wk-accent); border-bottom-color: var(--wk-accent); }
.work-col[data-status="in_progress"] .work-col-header { color: var(--wk-warn); border-bottom-color: var(--wk-warn); }
.work-col[data-status="blocked"]     .work-col-header { color: var(--wk-fail); border-bottom-color: var(--wk-fail); }
.work-col[data-status="done"]        .work-col-header { color: var(--wk-ok); border-bottom-color: var(--wk-ok); }

.work-col-cards,
.work-col .col-cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
  border-radius: var(--wk-radius-lg);
  transition: background var(--wk-transition), box-shadow var(--wk-transition);
}

.work-col-cards.drag-over,
.work-col .col-cards.drag-over {
  background: var(--wk-accent-soft);
  box-shadow: inset 0 0 0 2px rgba(94, 106, 210, 0.35);
}

.work-col-empty,
.work-col .col-empty {
  font-size: 12px;
  color: var(--wk-mute-2);
  padding: 16px 8px;
  text-align: center;
  border: 1px dashed var(--wk-line);
  border-radius: var(--wk-radius-lg);
}

/* Board cards */
.work-card,
.work-board .board-card {
  background: var(--wk-panel-2);
  border: 1px solid var(--wk-line);
  border-radius: var(--wk-radius-lg);
  padding: 10px 12px;
  font-size: 13px;
  cursor: grab;
  transition: border-color var(--wk-transition), box-shadow var(--wk-transition), opacity var(--wk-transition), transform var(--wk-transition);
  touch-action: none;
}

.work-card:hover,
.work-board .board-card:hover {
  border-color: var(--wk-line-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.work-card:active,
.work-board .board-card:active {
  cursor: grabbing;
}

.work-card.dragging,
.work-board .board-card.dragging {
  opacity: 0.45;
  transform: scale(0.98);
  box-shadow: var(--wk-shadow);
  border-color: var(--wk-accent);
  cursor: grabbing;
}

.work-card[data-status="done"],
.work-board .board-card[data-status="done"] {
  opacity: 0.65;
}

.work-card .card-top,
.work-board .board-card .card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
  gap: 6px;
}

.work-card .card-id,
.work-board .board-card .card-id {
  font-size: 10px;
  font-family: var(--wk-mono);
  color: var(--wk-mute);
}

.work-card .card-title,
.work-board .board-card .card-title {
  line-height: 1.4;
  margin-bottom: 6px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.work-card .card-title a,
.work-board .board-card a {
  color: var(--wk-text);
  text-decoration: none;
}

.work-card .card-title a:hover,
.work-board .board-card a:hover {
  color: var(--wk-accent-hover);
}

.work-card .card-meta,
.work-board .board-card .card-meta {
  font-size: 10px;
  color: var(--wk-mute);
  line-height: 1.4;
}

.work-card .card-footer,
.work-board .board-card .card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--wk-mute-2);
}

/* ── Scrollbars (WebKit) ───────────────────────────────────────── */

.work-app ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.work-app ::-webkit-scrollbar-track {
  background: transparent;
}

.work-app ::-webkit-scrollbar-thumb {
  background: var(--wk-surface-3);
  border-radius: 4px;
}

.work-app ::-webkit-scrollbar-thumb:hover {
  background: var(--wk-surface-3);
}

.work-app ::-webkit-scrollbar-corner {
  background: transparent;
}

/* ── Utilities ───────────────────────────────────────────────────── */

.work-muted { color: var(--wk-mute); }
.work-mono  { font-family: var(--wk-mono); }

.work-loading {
  padding: 24px;
  color: var(--wk-mute);
  font-size: 13px;
  animation: work-pulse 1.2s ease-in-out infinite;
}

@keyframes work-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* ── Detail close (mobile overlay) ─────────────────────────────── */

.work-detail-close {
  display: none;
  position: sticky;
  top: 0;
  z-index: 5;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin: 0 0 8px;
  padding: 0 4px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--wk-mute);
  background: var(--wk-panel);
  border: 0;
  border-bottom: 1px solid var(--wk-line);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.work-detail-close:hover,
.work-detail-close:focus-visible {
  color: var(--wk-text);
  outline: none;
  box-shadow: inset 0 -2px 0 var(--wk-accent);
}

.work-detail-close .work-detail-close-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 22px;
  line-height: 1;
  color: var(--wk-text);
}

.work-detail-body {
  min-height: 0;
}

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  :root {
    --wk-detail-w: min(400px, 38vw);
  }
}

/* Tablet: detail overlay, board scroll, icon sidebar */
@media (max-width: 900px) {
  :root {
    --wk-sidebar-w: 56px;
  }

  .work-sidebar .brand,
  .knoxed-brand span,
  .work-sidebar .nav-label,
  .knoxed-sidebar .nav-label,
  .work-sidebar a span:not(.icon):not(.wki),
  .knoxed-sidebar a > span:not(.wki),
  .work-sidebar .badge,
  .knoxed-sidebar .badge,
  .knoxed-sidebar kbd,
  .knoxed-sidebar .work-kbd {
    display: none;
  }

  .work-sidebar a,
  .knoxed-sidebar a,
  .knoxed-sidebar button.knoxed-search-btn {
    justify-content: center;
    padding: 10px 8px;
    min-height: 44px;
  }

  .work-main {
    flex-direction: row;
    width: 100%;
  }

  .work-list {
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border-right: none;
  }

  .work-list-header {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }

  .work-list-header h1 {
    flex: 1 1 auto;
    min-width: 0;
  }

  .work-list-header .search-wrap {
    flex: 1 1 100%;
    max-width: none;
    margin-left: 0;
    order: 10;
  }

  .work-saved-views {
    flex: 1 1 100%;
    order: 9;
  }

  .work-row {
    min-height: 44px;
    padding: 0 12px;
    align-items: center;
  }

  .work-detail {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    z-index: 200;
    box-shadow: var(--wk-shadow);
    padding: 0 12px 16px;
    -webkit-overflow-scrolling: touch;
  }

  .work-detail.empty {
    display: none;
  }

  .work-detail.is-open .work-detail-close {
    display: flex;
  }

  body.knoxed-detail-open {
    overflow: hidden;
  }

  .work-board {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 12px;
    align-items: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding: 12px 12px 20px;
  }

  .work-col {
    flex: 0 0 min(280px, 78vw);
    min-width: 240px;
    scroll-snap-align: start;
  }

  .work-topbar {
    padding: 0 12px;
    gap: 8px;
    overflow: hidden;
  }

  .work-topbar .actions a span,
  .work-topbar .actions button span {
    display: none;
  }

  .work-topbar kbd {
    display: none;
  }
}

/* Phone: tighter chrome, larger tap targets */
@media (max-width: 640px) {
  .work-list-header {
    padding: 8px 10px;
  }

  .work-list-header h1 {
    font-size: 14px;
  }

  .work-btn-new,
  .work-sv-save {
    min-height: 44px;
    padding: 8px 12px;
  }

  .work-list-header input[type="search"],
  .work-list-header .work-search {
    min-height: 44px;
    padding: 10px 10px 10px 32px;
    font-size: 16px;
  }

  .work-row .meta,
  .work-row .assignee {
    display: none;
  }

  .work-row .title {
    font-size: 14px;
  }

  .work-detail {
    padding: 0 10px 12px;
  }

  .work-modal-overlay {
    padding-top: 4vh;
  }

  .ck-overlay {
    padding-top: 48px;
  }

  .ck-panel {
    max-width: calc(100vw - 16px);
  }
}

/* ── Light theme ─────────────────────────────────────────────────────────── */
html.light {
  --wk-bg:         #f4f4f6;
  --wk-panel:      #ffffff;
  --wk-panel-2:    #f0f0f3;
  --wk-line:       rgba(0,0,0,0.10);
  --wk-line-strong:rgba(0,0,0,0.15);
  --wk-text:       #1a1a1f;
  --wk-mute:       #6b6b73;
  --wk-mute-2:     #9b9ba3;
  --wk-accent:     #5e6ad2;
  --wk-accent-hover:#4a57c4;
  --wk-accent-soft: rgba(94,106,210,0.12);
  --wk-ok:         #2d9a5f;
  --wk-warn:       #c47a00;
  --wk-fail:       #c0392b;
  --wk-surface-0:  rgba(0, 0, 0, 0.03);
  --wk-surface-1:  rgba(0, 0, 0, 0.05);
  --wk-surface-2:  rgba(0, 0, 0, 0.08);
  --wk-surface-3:  rgba(0, 0, 0, 0.11);
  --wk-shadow:     0 8px 32px rgba(0, 0, 0, 0.12);
}
html.light body.knoxed-app,
html.light .knoxed-app {
  background: var(--wk-bg);
  color: var(--wk-text);
}
