/* Jirrabit blue-theme stylesheet */
:root {
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;
  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-300: #cbd5e1;
  --ink-100: #f1f5f9;
  --ink-50: #f8fafc;
  --green: #16a34a;
  --orange: #f97316;
  --red: #dc2626;
  --yellow: #eab308;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 10px;
  --surface: white;
  --surface-fg: var(--ink-900);
  --surface-muted: var(--ink-50);
  --surface-border: var(--ink-100);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink-900);
  background: linear-gradient(180deg, var(--blue-50) 0%, var(--ink-50) 220px);
  min-height: 100vh;
  line-height: 1.45;
}

a { color: var(--blue-700); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--blue-800);
  color: white;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar a { color: white; opacity: .9; }
.topbar a:hover { opacity: 1; text-decoration: none; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: .3px; }
.brand span { color: var(--blue-200); }
.topbar nav { display: flex; gap: 14px; flex-wrap: wrap; }
.topbar .spacer { flex: 1; }
.topbar .search input {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: white;
  border-radius: 6px;
  padding: 6px 10px;
  width: 260px;
}
.topbar .search input::placeholder { color: var(--blue-100); }
.user-chip {
  background: var(--blue-700);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
}

.layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding: 24px; max-width: 1400px; margin: 0 auto; }
.sidebar {
  background: var(--surface);
  color: var(--surface-fg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  height: fit-content;
  position: sticky;
  top: 76px;
}
.sidebar h3 { margin: 0 0 8px 0; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-500); }
.sidebar ul { list-style: none; margin: 0 0 16px 0; padding: 0; }
.sidebar li { padding: 6px 8px; border-radius: 6px; font-size: 14px; }
.sidebar li:hover { background: var(--blue-50); }
.sidebar li a { color: var(--ink-700); display: block; }

.main { min-width: 0; }
.card {
  background: var(--surface);
  color: var(--surface-fg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card h1, .card h2, .card h3 { margin-top: 0; }

.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--blue-600);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.btn:hover { background: var(--blue-700); text-decoration: none; color: white; }
.btn.ghost { background: transparent; color: var(--blue-700); border: 1px solid var(--blue-200); }
.btn.ghost:hover { background: var(--blue-50); }
.btn.danger { background: var(--red); }
.btn.small { padding: 4px 10px; font-size: 12px; }

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
textarea, select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--ink-300);
  border-radius: 6px;
  background: var(--surface);
  color: var(--surface-fg);
  width: 100%;
}
input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px var(--blue-100);
}
input[type="checkbox"], input[type="radio"] {
  width: auto;
  margin: 0;
  flex: 0 0 auto;
}

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--ink-700); margin-bottom: 4px; font-weight: 500; }
.errors { color: var(--red); font-size: 13px; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--ink-100); font-size: 14px; }
th { color: var(--ink-500); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
tr:hover td { background: var(--blue-50); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  background: var(--blue-100);
  color: var(--blue-800);
}
.badge.todo { background: #e2e8f0; color: #475569; }
.badge.in_progress { background: var(--blue-100); color: var(--blue-800); }
.badge.done { background: #dcfce7; color: #166534; }
.badge.epic { background: #ede9fe; color: #5b21b6; }
.badge.story { background: #dcfce7; color: #166534; }
.badge.task { background: var(--blue-100); color: var(--blue-800); }
.badge.bug { background: #fee2e2; color: #991b1b; }
.badge.subtask { background: #e0f2fe; color: #075985; }

.priority-dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; vertical-align: middle; margin-right: 4px; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--blue-600); color: white; font-size: 11px; font-weight: 600;
  vertical-align: middle;
}
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
img.avatar { display: inline-block; object-fit: cover; }

.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.kanban .column {
  background: var(--ink-100); border-radius: var(--radius); padding: 12px;
  min-height: 320px; display: flex; flex-direction: column; gap: 10px;
}
.kanban .column h3 { margin: 0 0 6px 0; font-size: 13px; color: var(--ink-700); display: flex; justify-content: space-between; }
.kanban .column .count { background: white; padding: 1px 8px; border-radius: 999px; font-size: 11px; color: var(--ink-500); }
.kanban .card-issue {
  background: white; padding: 10px 12px; border-radius: 8px; box-shadow: var(--shadow);
  border-left: 4px solid var(--blue-500); cursor: grab; font-size: 13px;
}
.kanban .card-issue.dragging { opacity: .4; }
.kanban .column.drag-over { background: var(--blue-100); outline: 2px dashed var(--blue-400); }
.kanban .card-issue .meta { display: flex; justify-content: space-between; margin-top: 6px; color: var(--ink-500); font-size: 11px; }

.issue-detail { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
.issue-detail .sidebar-info { background: var(--ink-50); border-radius: var(--radius); padding: 14px; }
.issue-detail .sidebar-info dt { font-size: 11px; color: var(--ink-500); text-transform: uppercase; letter-spacing: .5px; margin-top: 10px; }
.issue-detail .sidebar-info dd { margin: 4px 0 0 0; font-size: 14px; }

.comments { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.comment { display: flex; gap: 10px; }
.comment.reply { margin-left: 36px; border-left: 2px solid var(--blue-200); padding-left: 8px; }
.comment.highlight { animation: highlight-flash 2s ease-out; }
@keyframes highlight-flash {
  0% { background: var(--blue-100); }
  100% { background: transparent; }
}
.comment .body { background: var(--ink-50); padding: 10px 12px; border-radius: 8px; flex: 1; }
.comment .meta { font-size: 12px; color: var(--ink-500); margin-bottom: 4px; }
.hidden { display: none; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--blue-50); color: var(--blue-800); }

.empty { text-align: center; color: var(--ink-500); padding: 36px 12px; }

/* Filter chips (board/list quick filters). */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; background: var(--ink-100); color: var(--ink-700);
  border: 1px solid var(--ink-100); text-decoration: none;
}
.chip:hover { background: var(--blue-50); border-color: var(--blue-200); text-decoration: none; }
.chip.active { background: var(--blue-600); color: white; border-color: var(--blue-600); }
.chip.clear { background: transparent; color: var(--red); border-color: var(--red); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 640px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 14px; }
  .sidebar { position: static; }
  .issue-detail { grid-template-columns: 1fr; }
  .topbar { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .topbar nav { gap: 8px; font-size: 13px; }
  .topbar .search input { width: 100%; min-width: 120px; }
  .topbar .search { flex: 1 1 100%; order: 5; }
  .kanban { grid-template-columns: 1fr; }
  table { font-size: 13px; }
  th, td { padding: 8px 6px; }
}

@media (max-width: 480px) {
  .topbar .brand { font-size: 16px; }
  .user-chip { font-size: 11px; padding: 4px 8px; }
  .btn { padding: 6px 10px; font-size: 13px; }
  .card { padding: 14px; }
}

/* ---------- Print ---------- */
@media print {
  body { background: white; color: black; }
  .topbar, .sidebar, .tabs, form, .btn, #htmx-spinner,
  #toast-stack, .modal-backdrop, .flash, .notif-link,
  #bulk-bar { display: none !important; }
  .layout { display: block; padding: 0; max-width: 100%; }
  .card { box-shadow: none; border: 1px solid #e2e8f0; page-break-inside: avoid; }
  .issue-detail { grid-template-columns: 1fr; }
  a { color: black; text-decoration: none; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 10px; color: #666; }
  a[href^="#"]::after, a[href^="javascript:"]::after { content: ""; }
  .kanban { display: block; }
  .kanban .column { page-break-inside: avoid; margin-bottom: 14px; background: white; border: 1px solid #e2e8f0; }
}

/* ---------- UX layer ---------- */

/* Inline-edit affordance: faint dotted underline on hover + pencil hint. */
.inline-edit { position: relative; border-radius: 4px; padding: 1px 4px; margin: -1px -4px; transition: background .12s; }
.inline-edit:hover { background: var(--blue-50); cursor: pointer; }
.inline-edit:hover::after {
  content: "✎"; position: absolute; right: -16px; top: 0; font-size: 11px; color: var(--blue-600); opacity: .7;
}

/* HTMX global spinner. Activated automatically when .htmx-request class
   appears on the body (htmx adds htmx-request to triggering elements;
   we mirror it via the htmx:beforeRequest listener). */
#htmx-spinner {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--blue-500) 50%, transparent 100%);
  background-size: 50% 100%; background-repeat: no-repeat;
  animation: htmx-bar 1s linear infinite;
  z-index: 9999; display: none; pointer-events: none;
}
body.htmx-busy #htmx-spinner { display: block; }
@keyframes htmx-bar { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* Persistent corner indicator while htmx is busy. Subtle, only appears
   after a small delay so quick requests don't flash it. */
#htmx-corner {
  position: fixed; bottom: 14px; left: 14px; z-index: 9998;
  width: 18px; height: 18px; border-radius: 999px;
  border: 2px solid var(--ink-300); border-top-color: var(--blue-600);
  opacity: 0; pointer-events: none;
  transition: opacity .15s linear .25s;
}
body.htmx-busy #htmx-corner { opacity: 1; animation: htmx-corner-spin .8s linear infinite; }
@keyframes htmx-corner-spin { to { transform: rotate(360deg); } }

/* Element-level spinner: HTMX adds .htmx-request to the triggering node. */
.htmx-request[hx-post], .htmx-request[hx-get], .htmx-request[hx-put], .htmx-request[hx-delete] {
  opacity: .6; pointer-events: none;
}

/* Toast stack. JS in main.js inserts <div class="toast"> children. */
#toast-stack {
  position: fixed; bottom: 20px; right: 20px; z-index: 10000;
  display: flex; flex-direction: column-reverse; gap: 8px; max-width: 360px;
}
.toast {
  background: var(--ink-900); color: white; padding: 10px 14px; border-radius: 8px;
  box-shadow: var(--shadow); font-size: 14px;
  animation: toast-in .2s ease-out;
  display: flex; align-items: center; gap: 10px;
}
.toast.ok { background: #16a34a; }
.toast.err { background: #dc2626; }
.toast.info { background: var(--blue-700); }
.toast button { background: transparent; border: 0; color: inherit; cursor: pointer; font-size: 16px; padding: 0; opacity: .7; }
.toast button:hover { opacity: 1; }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Modal scaffolding for confirm dialogs. */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  animation: fade-in .12s ease-out;
}
.modal {
  background: var(--surface); color: var(--surface-fg);
  border-radius: var(--radius); padding: 20px; min-width: 320px;
  max-width: 480px; box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 10px 0; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Tabs (issue detail). */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ink-100); margin: 14px 0; }
.tabs a {
  padding: 8px 14px; border-radius: 6px 6px 0 0; font-size: 14px; color: var(--ink-700);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { background: var(--blue-50); }
.tabs a.active { color: var(--blue-700); border-bottom-color: var(--blue-600); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Notification badge in topbar bell icon. */
.notif-link { position: relative; }
.notif-badge {
  position: absolute; top: -6px; right: -6px; background: #dc2626; color: white;
  font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 999px;
  min-width: 16px; text-align: center; line-height: 14px;
  display: none;
}
.notif-link[data-count]:not([data-count="0"]) .notif-badge { display: inline-block; }

/* Markdown editor with split preview. */
.md-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: relative; }
.md-editor textarea { min-height: 160px; }
.md-preview-pane {
  background: var(--ink-50); border: 1px solid var(--ink-100); border-radius: 6px;
  padding: 10px 12px; font-size: 14px; min-height: 160px; overflow: auto;
}
.md-preview-empty { color: var(--ink-500); font-style: italic; font-size: 12px; }
@media (max-width: 720px) { .md-editor { grid-template-columns: 1fr; } }

/* Slash command menu. */
.slash-menu {
  position: absolute; z-index: 90; background: var(--surface); color: var(--surface-fg);
  list-style: none; margin: 0; padding: 4px 0; border-radius: 6px; box-shadow: var(--shadow);
  border: 1px solid var(--surface-border); min-width: 220px;
}
.slash-menu li { padding: 4px 10px; font-size: 13px; cursor: pointer; }
.slash-menu li:hover, .slash-menu li.active { background: var(--blue-50); }

/* Done celebration: floating confetti dots. Triggered by JS adding ``.celebrate``. */
.celebrate-burst {
  position: fixed; pointer-events: none; z-index: 10000;
  width: 4px; height: 4px; border-radius: 50%; opacity: 0;
  animation: celebrate-pop .9s ease-out forwards;
}
@keyframes celebrate-pop {
  0% { transform: translate(0, 0) scale(0); opacity: 1; }
  60% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; }
}

/* Issue keys auto-linked from markdown. */
.issue-key { font-family: monospace; font-weight: 600; color: var(--blue-700); }
.issue-key::before { content: "🔗"; font-size: 9px; margin-right: 2px; opacity: .5; }

/* Side panel preview. */
#side-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 90vw;
  background: var(--surface); color: var(--surface-fg);
  box-shadow: -4px 0 24px rgba(15,23,42,.12); z-index: 70;
  transform: translateX(100%); transition: transform .18s ease-out;
  display: flex; flex-direction: column; overflow: hidden;
}
#side-panel.open { transform: translateX(0); }
.side-panel-head { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--ink-100); background: var(--ink-50); }
#side-panel-body { overflow: auto; padding: 14px; flex: 1; }
#side-panel-body .card { box-shadow: none; padding: 0; margin: 0; }
#side-panel-body .issue-detail { grid-template-columns: 1fr; }

/* Quick switcher modal. */
.qs-modal { width: 560px; max-width: 90vw; padding: 16px; }
.qs-modal input { width: 100%; font-size: 16px; padding: 10px 12px; }
.qs-modal .typeahead-list { margin-top: 10px; border: 1px solid var(--ink-100); border-radius: 6px; }
.qs-modal .typeahead-list li.active { background: var(--blue-100); border-left: 3px solid var(--blue-600); }
.qs-modal .typeahead-list li.active a { font-weight: 600; }
.qs-modal .typeahead-list li { transition: background .1s; }

/* Topbar typeahead dropdown. */
.typeahead-wrap { position: absolute; top: 100%; left: 0; right: 0; z-index: 60; }
.typeahead-list {
  background: var(--surface); color: var(--surface-fg); list-style: none; margin: 4px 0 0; padding: 4px 0;
  border-radius: 6px; box-shadow: var(--shadow); max-height: 320px; overflow: auto;
}
.typeahead-list li a { display: flex; gap: 8px; align-items: center; padding: 6px 10px; color: inherit; }
.typeahead-list li a:hover, .typeahead-list li a:focus { background: var(--blue-100); text-decoration: none; }

/* Mention autocomplete dropdown anchored to a wrapper. */
.mention-wrap { position: relative; }
.mention-suggestions { background: var(--surface); color: var(--surface-fg); border: 1px solid var(--surface-border); border-radius: 6px;
  box-shadow: var(--shadow); list-style: none; margin: 4px 0 0; padding: 4px 0;
  position: absolute; z-index: 100; max-height: 220px; overflow: auto; min-width: 220px; }
.mention-suggestions li { padding: 4px 10px; cursor: pointer; font-size: 13px; }
.mention-suggestions li:hover, .mention-suggestions li.active { background: var(--blue-50); }

/* Attachment image thumbnails. */
.attachment-thumb {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 0;
  font-size: 13px;
}
.attachment-thumb img { max-width: 48px; max-height: 48px; border-radius: 4px; object-fit: cover; border: 1px solid var(--ink-300); }

/* Copy-to-clipboard button. */
.copy-btn { background: transparent; border: 1px solid var(--ink-300); border-radius: 4px;
  padding: 2px 8px; font-size: 12px; cursor: pointer; }
.copy-btn:hover { background: var(--blue-50); border-color: var(--blue-400); }
.copy-btn.copied { background: #dcfce7; color: #166534; border-color: #86efac; }

/* --- Keyboard shortcuts, cheatsheet, command palette --- */
.kbd-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 10vh; z-index: 200;
}
.kbd-modal, .cmd-modal {
  background: var(--surface); color: var(--surface-fg); border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  width: min(560px, 92vw);
  font-size: 13px;
}
.kbd-modal header, .cmd-modal footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--ink-100);
}
.cmd-modal footer { border-bottom: 0; border-top: 1px solid var(--ink-100); color: var(--ink-500); font-size: 11px; }
.kbd-modal header button { background: transparent; border: 0; font-size: 18px; cursor: pointer; color: var(--ink-700); }
.kbd-modal table { width: 100%; border-collapse: collapse; }
.kbd-modal td { padding: 6px 14px; }
.kbd-modal td:first-child { width: 140px; }
.kbd-modal kbd {
  background: var(--ink-50); border: 1px solid var(--ink-300); border-bottom-width: 2px;
  padding: 1px 6px; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 11px;
}
.cmd-modal input[type="search"] {
  width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--surface-border);
  font-size: 15px; outline: none; border-radius: 8px 8px 0 0;
  background: var(--surface); color: var(--surface-fg);
}
.cmd-results { list-style: none; margin: 0; padding: 4px 0; max-height: 50vh; overflow: auto; }
.cmd-results li { display: grid; grid-template-columns: 70px 1fr auto;
  gap: 8px; padding: 8px 14px; cursor: pointer; align-items: center; }
.cmd-results li.active, .cmd-results li:hover { background: var(--blue-50); }
.cmd-results li.empty { color: var(--ink-500); justify-content: center; cursor: default; grid-template-columns: 1fr; text-align: center; }
.cmd-type {
  font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink-500); border: 1px solid var(--ink-300); border-radius: 999px;
  padding: 1px 8px; text-align: center;
}
.cmd-hint { color: var(--ink-500); font-size: 11px; }

/* WIP limit overflow: red outline + tinted count chip. */
.kanban .column.wip-over { outline: 2px solid var(--red); outline-offset: -2px; }
.kanban .column.wip-over .count { background: #fee2e2; color: #991b1b; }

/* Internal comments (staff-only notes). */
.comment.internal .body { background: #fef9c3; border-left: 3px solid #ca8a04; }
.comment.internal .internal-banner {
  display: inline-block; font-size: 11px; font-weight: 600;
  color: #854d0e; background: #fef08a; padding: 1px 8px; border-radius: 999px;
  margin-bottom: 6px;
}

/* Markdown editor toolbar. */
.md-toolbar { display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 4px; }
.md-toolbar .md-tool {
  background: var(--ink-50); border: 1px solid var(--ink-300); border-radius: 4px;
  padding: 2px 8px; font-size: 12px; cursor: pointer; min-width: 28px; line-height: 1;
}
.md-toolbar .md-tool:hover { background: var(--blue-50); border-color: var(--blue-400); }

/* Sticky bulk action bar on board/backlog. */
.bulk-bar-sticky {
  position: sticky; top: 60px; z-index: 40;
  background: var(--blue-50); border: 1px solid var(--blue-200);
  margin-bottom: 14px;
}
.bulk-bar-sticky form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Onboarding banner. */
.onboarding-card { border-left: 4px solid var(--blue-500); }
.onboarding-card kbd {
  background: var(--ink-100); border: 1px solid var(--ink-300); border-bottom-width: 2px;
  padding: 1px 6px; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 11px;
}

/* Story-points chip on board cards. */
.kanban .card-issue .sp-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--ink-100); color: var(--ink-700);
  padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 600;
  min-width: 22px; justify-content: center;
}
.kanban .card-issue .sp-chip:before { content: "◆"; opacity: .6; }
.kanban .card-issue .sp-chip .inline-edit { cursor: pointer; }

/* Form field help text. */
.help-text { font-size: 11px; color: var(--ink-500); margin-top: 4px; }

/* Inline-edit save indicator. */
.inline-edit.just-saved { position: relative; }
.inline-edit.just-saved::after {
  content: "✓ guardado";
  position: absolute; right: -90px; top: 50%; transform: translateY(-50%);
  color: #16a34a; font-size: 11px; font-weight: 600; white-space: nowrap;
  animation: fade-out 1s ease-out 0.2s forwards;
}
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

/* Skeleton loaders. Use ``.skeleton`` (basic block) or composables
   (.skeleton-line, .skeleton-card) for placeholder UI while data loads. */
.skeleton {
  background: linear-gradient(90deg, var(--ink-100) 25%, var(--ink-50) 50%, var(--ink-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite linear;
  border-radius: 6px;
  color: transparent;
  user-select: none;
}
.skeleton-line { height: 12px; margin: 6px 0; border-radius: 6px; }
.skeleton-card { height: 56px; border-radius: 8px; margin-bottom: 10px; }
.skeleton-avatar { width: 28px; height: 28px; border-radius: 999px; display: inline-block; }
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* While htmx is busy with a kanban swap, dim and shimmer slightly. */
body.htmx-busy .kanban { opacity: .7; transition: opacity .2s; }

/* Online/offline banner. */
#net-status {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--red); color: white; padding: 8px 14px;
  text-align: center; font-size: 13px; font-weight: 500;
  z-index: 250; box-shadow: 0 -2px 12px rgba(0, 0, 0, .15);
}

/* Topbar user dropdown. */
.user-menu { position: relative; }
.user-menu .user-chip {
  background: var(--blue-700); color: white;
  padding: 6px 12px; border: 0; border-radius: 999px;
  cursor: pointer; font-size: 13px;
}
.user-menu .user-chip:hover { background: var(--blue-800); }
.user-menu-pop {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface); color: var(--surface-fg);
  border: 1px solid var(--surface-border); border-radius: 8px;
  box-shadow: var(--shadow); min-width: 200px;
  padding: 6px 0; z-index: 80;
}
.user-menu.open .user-menu-pop { display: block; }
.user-menu-pop[hidden] { display: none; }
.user-menu.open .user-menu-pop[hidden] { display: block; }
.user-menu-pop a,
.user-menu-pop .user-menu-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; color: var(--surface-fg) !important;
  text-decoration: none; font-size: 13px; cursor: pointer;
  background: transparent; border: 0; width: 100%; text-align: left;
}
.user-menu-pop a:hover,
.user-menu-pop .user-menu-logout:hover { background: var(--blue-50); text-decoration: none; }
.user-menu-sep { height: 1px; background: var(--surface-border); margin: 4px 0; }

/* Live-changes banner. */
.live-banner {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; gap: 10px; align-items: center;
  background: var(--blue-700); color: white;
  padding: 8px 14px; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .25);
}
.live-banner .live-refresh { background: white; color: var(--blue-700); }
.live-banner .live-refresh:hover { background: var(--blue-50); }
.live-banner .live-dismiss {
  background: transparent; border: 0; color: inherit; font-size: 18px; cursor: pointer;
  padding: 0 4px;
}

/* Card meta: inline-edit chips for priority/due. */
.kanban .card-issue .meta { gap: 8px; flex-wrap: wrap; }
.kanban .card-issue .meta-left { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kanban .card-issue .card-priority,
.kanban .card-issue .card-due {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; color: var(--ink-700);
}
.kanban .card-issue .card-priority .inline-edit,
.kanban .card-issue .card-due .inline-edit { font-size: 10px; padding: 0; }

/* Optimistic UI pending state. */
.optimistic { opacity: .55; pointer-events: none; transition: opacity .15s; }

/* Toast action button (undo). */
.toast .toast-action {
  background: white; color: var(--blue-700);
  border: 0; border-radius: 4px; padding: 2px 10px;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.toast .toast-action:hover { background: var(--blue-50); }
.toast .toast-close {
  background: transparent; border: 0; color: inherit; cursor: pointer;
  font-size: 14px; padding: 0 4px;
}
.toast { display: flex; gap: 10px; align-items: center; }

/* Draft autosave indicator. */
.draft-indicator { font-size: 11px; color: var(--ink-500); margin-top: 4px; }
.draft-indicator[data-kind="restored"] { color: var(--blue-700); font-weight: 500; }
.draft-indicator[data-kind="saved"]::before { content: "✓ "; color: #16a34a; }

/* Sidebar drag-reorder. */
.sidebar li[draggable="true"] { cursor: grab; }
.sidebar li[draggable="true"]:hover::before { content: "⋮⋮ "; color: var(--ink-300); margin-right: 2px; }
.sidebar li.dragging { opacity: .4; cursor: grabbing; }

/* Breadcrumb. */
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; margin-bottom: 8px; }
.breadcrumb a { color: var(--ink-500); }
.breadcrumb a:hover { color: var(--blue-700); }
.breadcrumb .sep { color: var(--ink-300); }
.breadcrumb strong { color: var(--ink-900); }

/* Daily tip card. */
.tip-card { border-left: 4px solid var(--yellow); }
.tip-card kbd, .tip-card code {
  background: var(--ink-100); border: 1px solid var(--ink-300);
  padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 11px;
}

/* Empty states improved: bigger icon, looser spacing. Selectively applied
   to ``.empty.illustrated`` so we don't break compact table cells. */
.empty.illustrated {
  text-align: center; padding: 40px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty.illustrated::before {
  content: attr(data-icon);
  font-size: 40px; line-height: 1;
  opacity: .55;
}
.empty.illustrated p { margin: 0; color: var(--ink-500); font-size: 13px; }
.empty.illustrated .empty-cta { margin-top: 8px; }

/* Reactions quick-bar: hidden until comment hover. */
.reactions { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.reactions-quick {
  display: inline-flex; gap: 2px;
  opacity: 0; visibility: hidden;
  transition: opacity .15s, visibility .15s;
}
.comment:hover .reactions-quick,
.reactions-quick:focus-within { opacity: 1; visibility: visible; }
.reactions-quick form { display: inline; margin: 0; }
.reactions-quick-btn {
  background: var(--ink-50); border: 1px solid var(--surface-border);
  border-radius: 6px; padding: 1px 6px; font-size: 14px; cursor: pointer;
  line-height: 1.2;
}
.reactions-quick-btn:hover { background: var(--blue-50); transform: scale(1.1); }

/* Markdown editor tabs mode. */
.md-editor.tabs-mode { display: block; }
.md-tabs { display: flex; gap: 2px; margin-bottom: 4px; }
.md-tab {
  background: transparent; border: 1px solid transparent;
  padding: 4px 12px; font-size: 12px; cursor: pointer; border-radius: 6px 6px 0 0;
  color: var(--ink-700);
}
.md-tab.active { background: var(--surface); border-color: var(--surface-border); border-bottom-color: var(--surface); color: var(--surface-fg); font-weight: 600; }
.md-editor.tabs-mode .md-preview-pane[hidden] { display: none; }

/* Drag handle hint on hover. */
.kanban .card-issue { position: relative; }
.kanban .card-issue::before {
  content: "⋮⋮"; position: absolute; left: -14px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-300); font-size: 14px; opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.kanban .card-issue:hover::before { opacity: 1; }

/* Collapsible sprint groups in backlog. */
details.sprint-group { padding: 14px 20px; }
details.sprint-group summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
details.sprint-group summary::-webkit-details-marker { display: none; }
details.sprint-group .sprint-caret { transition: transform .15s; display: inline-block; color: var(--ink-500); }
details.sprint-group:not([open]) .sprint-caret { transform: rotate(-90deg); }
details.sprint-group[open] summary { margin-bottom: 8px; }

/* My-day widget. */
.my-day-card { border-left: 4px solid var(--blue-600); }
/* Avatar ring on high-priority issues. */
.avatar.priority-ring { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--red); }

/* Estimate progress bar. */
.estimate-bar { height: 6px; background: var(--ink-100); border-radius: 999px; margin: 4px 0; overflow: hidden; }
.estimate-bar-fill { height: 100%; border-radius: 999px; transition: width .3s; }

/* Inline validation visual. */
input.invalid, textarea.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}

/* Board presentation mode (toggle with F). */
body.presentation .topbar,
body.presentation .sidebar,
body.presentation #bulk-bar,
body.presentation .breadcrumb { display: none !important; }
body.presentation .layout { grid-template-columns: 1fr; padding: 0; max-width: none; }
body.presentation .main { padding: 16px; }
body.presentation .kanban { gap: 20px; }
body.presentation .kanban .card-issue { font-size: 15px; padding: 14px 16px; }
body.presentation .kanban .column h3 { font-size: 18px; }
body.presentation::before {
  content: "📺 Modo presentación · pulsa F para salir";
  position: fixed; top: 10px; right: 14px; z-index: 200;
  background: var(--ink-900); color: white; padding: 4px 10px;
  border-radius: 999px; font-size: 11px; opacity: .7;
}

/* Sticky tabs on issue detail so they stay visible while scrolling. */
.issue-detail .tabs {
  position: sticky; top: 60px; z-index: 30;
  background: var(--surface);
  margin: 14px 0;
  padding-top: 2px;
}
