/* IdeaIQ — shared idea / bug board. Dark-theme, DealIQ token-driven.
 * Loaded on every page (orchestrator adds the <link>). All colors via theme
 * CSS variables so it tracks the active theme + accent automatically. */

/* ---- top-bar launch button (peer of other .ghost-btn) -------------------- */
.iiq-launch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.iiq-launch-glyph {
  font-size: 13px;
  line-height: 1;
  filter: saturate(1.1);
}

/* ---- overlay backdrop ---------------------------------------------------- */
.iiq-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 20px 40px;
  background: color-mix(in srgb, var(--bg-0) 72%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-y: auto;
}
.iiq-overlay[hidden] { display: none; }

/* ---- board modal --------------------------------------------------------- */
.iiq-board {
  width: 100%;
  max-width: 760px;
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  color: var(--text-primary);
  font-family: var(--font-sans, system-ui, sans-serif);
}

/* ---- header -------------------------------------------------------------- */
.iiq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex: 0 0 auto;
}
.iiq-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.iiq-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.iiq-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.iiq-close:hover { color: var(--text-primary); border-color: var(--border-strong); }
.iiq-back {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.iiq-back:hover { color: var(--text-primary); border-color: var(--border-strong); }

/* ---- filters ------------------------------------------------------------- */
.iiq-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.iiq-chip-filter {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-tertiary, var(--text-2));
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 120ms ease;
}
.iiq-chip-filter:hover { color: var(--text-secondary); border-color: var(--border-strong); }
.iiq-chip-filter.active {
  background: var(--accent-blue-tint, color-mix(in srgb, var(--accent-blue) 12%, transparent));
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* ---- list ---------------------------------------------------------------- */
.iiq-list {
  padding: 12px 18px 18px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.iiq-loading, .iiq-empty, .iiq-timeline-empty {
  color: var(--text-tertiary, var(--text-2));
  font-size: 13px;
  padding: 24px 4px;
  text-align: center;
}

.iiq-card {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--bg-2);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 80ms ease;
}
.iiq-card:hover {
  border-color: var(--accent-blue-edge, var(--border-strong));
  background: var(--bg-3, var(--bg-2));
}
.iiq-card:active { transform: translateY(1px); }
.iiq-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}
.iiq-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 8px;
}
.iiq-card-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-tertiary, var(--text-2));
}
.iiq-card-author { color: var(--text-secondary); }
.iiq-dot { color: var(--text-tertiary, var(--text-3)); }
.iiq-card-comments { color: var(--text-secondary); }

/* ---- chips (kind) -------------------------------------------------------- */
.iiq-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.iiq-chip-idea {
  color: var(--gold, var(--warning));
  border-color: color-mix(in srgb, var(--gold, var(--warning)) 45%, transparent);
  background: color-mix(in srgb, var(--gold, var(--warning)) 12%, transparent);
}
.iiq-chip-bug {
  color: var(--negative);
  border-color: color-mix(in srgb, var(--negative) 45%, transparent);
  background: color-mix(in srgb, var(--negative) 12%, transparent);
}

/* ---- status pills -------------------------------------------------------- */
.iiq-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
/* open = neutral/info */
.iiq-st-open {
  color: var(--text-secondary);
  border-color: var(--border-strong, var(--border));
  background: color-mix(in srgb, var(--text-secondary) 8%, transparent);
}
/* planned = info */
.iiq-st-planned {
  color: var(--accent-blue);
  border-color: color-mix(in srgb, var(--accent-blue) 45%, transparent);
  background: color-mix(in srgb, var(--accent-blue) 12%, transparent);
}
/* in_progress = warning */
.iiq-st-progress {
  color: var(--warning, var(--warn));
  border-color: color-mix(in srgb, var(--warning, var(--warn)) 45%, transparent);
  background: color-mix(in srgb, var(--warning, var(--warn)) 12%, transparent);
}
/* done = positive */
.iiq-st-done {
  color: var(--positive);
  border-color: color-mix(in srgb, var(--positive) 45%, transparent);
  background: color-mix(in srgb, var(--positive) 14%, transparent);
}
/* declined = muted/negative */
.iiq-st-declined {
  color: var(--negative);
  border-color: color-mix(in srgb, var(--negative) 40%, transparent);
  background: color-mix(in srgb, var(--negative) 10%, transparent);
  opacity: 0.85;
}

/* ---- avatar -------------------------------------------------------------- */
.iiq-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex: 0 0 auto;
}

/* ---- new form ------------------------------------------------------------ */
.iiq-form {
  padding: 18px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.iiq-seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}
.iiq-seg-btn {
  background: var(--bg-2);
  border: 0;
  color: var(--text-secondary);
  padding: 7px 16px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.iiq-seg-btn + .iiq-seg-btn { border-left: 1px solid var(--border); }
.iiq-seg-btn.active {
  background: var(--accent-blue-tint, color-mix(in srgb, var(--accent-blue) 14%, transparent));
  color: var(--accent-blue);
}
.iiq-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary, var(--text-2));
  margin: 0 0 6px;
}
.iiq-label-inline {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary, var(--text-2));
}
.iiq-input, .iiq-textarea {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 9px 11px;
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
  box-sizing: border-box;
  margin-bottom: 14px;
}
.iiq-input:focus, .iiq-textarea:focus {
  outline: none;
  border-color: var(--accent-blue-edge, var(--accent-blue));
  background: var(--bg-1);
}
.iiq-textarea { resize: vertical; }
.iiq-input-err { border-color: var(--negative); }
.iiq-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* ---- detail -------------------------------------------------------------- */
.iiq-detail {
  padding: 18px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.iiq-d-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.iiq-d-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 8px;
}
.iiq-d-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-tertiary, var(--text-2));
  margin-bottom: 14px;
}
.iiq-d-body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
  white-space: pre-wrap;
  margin-bottom: 12px;
}
.iiq-d-context {
  font-size: 12px;
  color: var(--text-tertiary, var(--text-2));
  margin-bottom: 16px;
}
.iiq-d-context code {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--text-secondary);
}

/* ---- admin controls ------------------------------------------------------ */
.iiq-admin {
  border: 1px solid var(--accent-blue-edge, var(--border-strong));
  background: color-mix(in srgb, var(--accent-blue) 5%, var(--bg-2));
  border-radius: 9px;
  padding: 14px;
  margin-bottom: 18px;
}
.iiq-admin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.iiq-admin-row .iiq-input { margin-bottom: 0; }
.iiq-status-select {
  background: var(--bg-0);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
  flex: 1 1 auto;
}
.iiq-status-select:focus { outline: none; border-color: var(--accent-blue-edge, var(--accent-blue)); }
.iiq-apply-status { flex: 0 0 auto; }
.iiq-checkoff {
  width: 100%;
  background: var(--positive);
  color: var(--bg-0);
  border: 0;
  padding: 9px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.iiq-checkoff:hover { filter: brightness(1.08); }
.iiq-readonly-status {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

/* ---- timeline ------------------------------------------------------------ */
.iiq-timeline-h {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary, var(--text-2));
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-bottom: 12px;
}
.iiq-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.iiq-tl-time {
  color: var(--text-tertiary, var(--text-3));
  font-size: 11px;
  margin-left: auto;
}
.iiq-tl-icon { opacity: 0.85; }

/* status_change — terse, inline */
.iiq-tl-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0;
}
.iiq-tl-status strong { color: var(--text-primary); font-weight: 600; }

/* implementation — distinct, called-out block */
.iiq-tl-impl {
  border-left: 3px solid var(--positive);
  background: color-mix(in srgb, var(--positive) 8%, transparent);
  border-radius: 0 7px 7px 0;
  padding: 9px 12px;
}
.iiq-tl-impl-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--positive);
  font-weight: 600;
  margin-bottom: 5px;
}
.iiq-tl-impl-head .iiq-tl-time { color: var(--text-tertiary, var(--text-3)); font-weight: 400; }
.iiq-tl-impl-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* comment */
.iiq-tl-comment {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--bg-2);
}
.iiq-tl-c-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.iiq-tl-c-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ---- comment compose ----------------------------------------------------- */
.iiq-comment-box {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.iiq-comment-box .iiq-textarea { margin-bottom: 0; }
.iiq-comment-send { align-self: flex-end; }

/* ---- toast --------------------------------------------------------------- */
.iiq-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--bg-3, var(--bg-2));
  color: var(--text-primary);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 5000;
  pointer-events: none;
}
.iiq-toast-in {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* fallback when no primary-btn-sm in host stylesheet — keep submit usable */
.iiq-board .primary-btn-sm {
  cursor: pointer;
}
