/* === ISSUES.md — Dark Theme === */

:root {
  --bg-1000: #0f1114;
  --bg-900: #16181c;
  --bg-800: #1f2126;
  --bg-600: #2c2f36;
  --bg-400: #3b3f48;
  --bg-300: #4b4f5b;
  --bg-200: #5a5f6b;
  --bg-150: #727887;
  --bg-100: #c4c7d1;
  --bg-50: #e3e5ec;

  --accent-primary: #5d93ff;
  --accent-success: #95c23d;
  --accent-danger: #cc4b4b;
  --accent-warning: #f2b84b;
  --accent-info: #b487ff;

  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
}

/* === Reset === */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 15px;
  background: var(--bg-1000);
  color: var(--bg-50);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[x-cloak] {
  display: none !important;
}

/* === Scrollbar === */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-900);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-400);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--bg-300);
}

/* === App Layout === */

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

.app-container--with-flow {
  max-width: 1180px;
}

.workspace-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  padding-top: 0.35rem;
}

.workspace-shell--with-flow {
  grid-template-columns: minmax(0, 1fr) 210px;
  column-gap: 1rem;
  align-items: start;
}

.workspace-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* === Header === */

.app-header {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--bg-600);
  flex-shrink: 0;
  gap: 0.75rem;
}

.header-left {
  display: flex;
  align-items: center;
  grid-column: 1;
  justify-self: start;
  gap: 0.45rem;
  min-width: 0;
}

.app-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--bg-50);
  display: flex;
  align-items: center;
  grid-column: 2;
  justify-self: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  text-align: center;
}

.app-title-main,
.app-title .filename {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-title-link {
  color: inherit;
  text-decoration: none;
}

.app-title-link:hover,
.app-title-link:focus-visible {
  color: var(--bg-50);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.app-title .filename {
  color: var(--bg-150);
  font-weight: 400;
  font-size: 0.8rem;
}

.header-actions {
  display: flex;
  align-items: center;
  grid-column: 3;
  justify-self: end;
  gap: 0.4rem;
  min-width: 0;
}

.collaboration-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  margin: 0.6rem 0 0;
  border: 1px solid rgba(242, 184, 75, 0.45);
  border-radius: 10px;
  background: rgba(242, 184, 75, 0.12);
  color: var(--bg-50);
  flex-shrink: 0;
}

.collaboration-banner span {
  font-size: 0.8rem;
}

/* === Toolbar === */

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--bg-600);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.search-input {
  min-width: 100px;
  max-width: 200px;
  flex: 1;
  padding: 0.28rem 0.5rem;
  border: 1px solid var(--bg-600);
  border-radius: 6px;
  background: var(--bg-900);
  color: var(--bg-50);
  font-size: 0.78rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-input:focus {
  border-color: var(--accent-primary);
}
.search-input::placeholder {
  color: var(--bg-300);
}

/* Vertical divider between filter groups — only visible when on same row */
.toolbar-divider {
  width: 1px;
  align-self: stretch;
  margin: 3px 0;
  background: var(--bg-400);
  flex-shrink: 0;
}

/* === Pill Button Groups (status filter, category filter) === */

.pill-group {
  display: flex;
  gap: 3px;
  align-items: center;
}

.pill-btn {
  padding: 0.2rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--bg-600);
  border-radius: 999px;
  background: transparent;
  color: var(--bg-150);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}

.pill-btn:hover {
  border-color: var(--bg-100);
  color: var(--bg-50);
}

.pill-btn.active {
  background: var(--bg-50);
  border-color: var(--bg-50);
  color: var(--bg-900);
}

/* Category filter pills with semantic colors when active */
.pill-btn--bugfixes.active {
  background: var(--accent-danger);
  border-color: var(--accent-danger);
  color: #fff;
}
.pill-btn--improvements.active {
  background: var(--accent-success);
  border-color: var(--accent-success);
  color: var(--bg-900);
}
.pill-btn--features.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}
.pill-btn--maintenance.active {
  background: var(--accent-warning);
  border-color: var(--accent-warning);
  color: var(--bg-900);
}
.pill-btn--planning.active {
  background: var(--accent-info);
  border-color: var(--accent-info);
  color: var(--bg-900);
}

.issue-action-group {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.header-issue-action-group {
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: min(34vw, 34rem);
  row-gap: 0.25rem;
  overflow-x: visible;
}

.issue-action-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 3px;
  max-width: 100%;
}

.issue-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  max-width: 15rem;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.issue-action-btn--cleanup .issue-action-btn,
.issue-action-btn--maintenance .issue-action-btn {
  border-color: rgba(242, 184, 75, 0.72);
  color: var(--accent-warning);
}

.issue-action-btn--cleanup .issue-action-btn:hover,
.issue-action-btn--cleanup .issue-action-btn:focus-visible,
.issue-action-btn--maintenance .issue-action-btn:hover,
.issue-action-btn--maintenance .issue-action-btn:focus-visible {
  border-color: var(--accent-warning);
  color: var(--bg-50);
}

.issue-action-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.execution-output {
  margin-top: 0.45rem;
  padding: 0.65rem;
  border-radius: 10px;
  background: var(--bg-1000);
  color: var(--bg-50);
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.execution-output--error {
  border: 1px solid rgba(204, 75, 75, 0.45);
  color: #ffb8b8;
}

/* === Buttons === */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--bg-600);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  background: var(--bg-800);
  color: var(--bg-50);
}

.btn:hover {
  background: var(--bg-600);
  border-color: var(--bg-400);
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}
.btn-primary:hover {
  background: #4a80ee;
  border-color: #4a80ee;
}

.btn-success {
  background: var(--accent-success);
  border-color: var(--accent-success);
  color: var(--bg-900);
}
.btn-success:hover {
  background: #83ad30;
  border-color: #83ad30;
}

.btn-sm {
  padding: 0.18rem 0.45rem;
  font-size: 0.68rem;
}

/* Icon button (circular) */
.icon-button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--bg-600);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1;
  color: var(--bg-150);
  transition:
    transform 0.1s ease,
    background 0.15s ease,
    color 0.15s ease;
  background: transparent;
}

.icon-button:not(:disabled):hover {
  background: var(--bg-50);
  color: var(--bg-900);
  border-color: var(--bg-50);
}

.icon-button:not(:disabled):active {
  transform: scale(0.95);
}
.icon-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-button--danger:not(:disabled):hover {
  background: var(--accent-danger);
  border-color: var(--accent-danger);
  color: #fff;
}

.icon-button svg {
  width: 0.9rem;
  height: 0.9rem;
}

/* === Issue Cards List === */

.issues-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* === Issue Card === */

.issue-card {
  border: 1px solid var(--bg-600);
  border-radius: 6px;
  padding: 0.55rem 0.8rem;
  background: var(--bg-800);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color 0.2s ease;
  color: var(--bg-50);
  cursor: pointer;
}

.issue-card:hover {
  border-color: var(--bg-400);
}

.issue-card.is-closed {
  opacity: 0.55;
}

/* Card header: title + meta tags */
.issue-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 26px;
}

.issue-title {
  font-weight: 500;
  color: var(--bg-50);
  font-size: 0.86rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-card.is-closed .issue-title {
  text-decoration: line-through;
  color: var(--bg-200);
}

.issue-header-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.issue-copy-button {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.issue-copy-button svg {
  width: 0.78rem;
  height: 0.78rem;
}

/* Issue meta button — reset for <button> tags in card header */
.issue-meta-button {
  appearance: none;
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  line-height: inherit;
  cursor: pointer;
}

.issue-meta-button:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.issue-meta-button:disabled {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

/* Meta separator pipe between tags */
.issue-meta-separator {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--bg-300);
}

/* === Selection Popover === */

.issue-selection-popover {
  position: absolute;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.96);
  border: 1px solid var(--bg-600);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
  z-index: 60;
  transform: translateX(-50%);
}

.issue-selection-option {
  appearance: none;
  font: inherit;
  line-height: inherit;
  cursor: pointer;
}

.issue-action-popover-option {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  border-color: rgba(242, 184, 75, 0.5);
  color: var(--accent-warning);
}

.issue-action-popover-option:hover,
.issue-action-popover-option:focus-visible {
  border-color: var(--accent-warning);
  color: var(--bg-50);
}

.issue-selection-option.is-selected {
  box-shadow: 0 0 0 2px var(--bg-50) inset;
}

.issue-selection-option:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Category tag */
.issue-category-tag {
  --cat-color: var(--bg-600);
  --cat-text: var(--bg-150);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1.5px solid var(--cat-color);
  color: var(--cat-text);
  display: inline-flex;
  align-items: center;
  background: color-mix(in srgb, var(--cat-color) 20%, transparent);
  white-space: nowrap;
}

.issue-category-tag--features {
  --cat-color: var(--accent-primary);
  --cat-text: var(--accent-primary);
}
.issue-category-tag--improvements {
  --cat-color: var(--accent-success);
  --cat-text: var(--accent-success);
}
.issue-category-tag--bugfixes {
  --cat-color: var(--accent-danger);
  --cat-text: var(--accent-danger);
}
.issue-category-tag--maintenance {
  --cat-color: var(--accent-warning);
  --cat-text: var(--accent-warning);
}
.issue-category-tag--planning {
  --cat-color: var(--accent-info);
  --cat-text: var(--accent-info);
}

/* Priority tag */
.issue-priority-tag {
  --pri-color: var(--bg-400);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1.5px solid var(--pri-color);
  color: var(--pri-color);
  background: color-mix(in srgb, var(--pri-color) 20%, transparent);
  white-space: nowrap;
}

.issue-priority-tag--p0 {
  --pri-color: var(--accent-danger);
}
.issue-priority-tag--p1 {
  --pri-color: var(--accent-warning);
}
.issue-priority-tag--p2 {
  --pri-color: var(--accent-info);
}

/* Status badge */
.issue-status-badge {
  --status-color: var(--bg-400);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1.5px solid var(--status-color);
  background: color-mix(in srgb, var(--status-color) 20%, transparent);
  color: var(--status-color);
  white-space: nowrap;
}

.issue-status-badge--open {
  --status-color: var(--accent-success);
}
.issue-status-badge--blocked {
  --status-color: var(--accent-warning);
}
.issue-status-badge--pr_open {
  --status-color: var(--accent-primary);
}
.issue-status-badge--closed {
  --status-color: var(--accent-danger);
}

/* Card meta row (dependencies) */
.issue-meta {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.issue-dependency-tag {
  appearance: none;
  display: inline-flex;
  align-items: center;
  font-size: 0.58rem;
  font-weight: 500;
  color: var(--bg-200);
  padding: 0rem 0.3rem;
  border: 1px solid var(--bg-600);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.issue-dependency-label {
  font-size: 0.55rem;
  color: var(--bg-300);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.issue-dependency-tag:hover,
.issue-dependency-tag:focus-visible {
  border-color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary) 15%, transparent);
}

/* Card ID (right-aligned) */
.issue-card-id {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--bg-300);
  text-align: right;
  letter-spacing: 0.04em;
  margin-left: auto;
}

/* Card body row: description + ID on same line */
.issue-body-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
}

.issue-body-row .issue-card-id {
  flex-shrink: 0;
  margin-left: auto;
  align-self: flex-end;
}

/* Card body */
.issue-body {
  font-size: 0.78rem;
  color: var(--bg-150);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  flex: 1;
  min-width: 0;
}

.issue-body p {
  margin: 0;
}
.issue-body a {
  color: var(--accent-primary);
}
.issue-body img {
  max-width: 48px;
  max-height: 48px;
  height: auto;
  border-radius: 4px;
  display: inline-block;
  vertical-align: middle;
  object-fit: cover;
  opacity: 0.8;
}

/* === Inline Issue Editing (card expands in place) === */

.issue-card.is-editing {
  border-color: var(--bg-400);
  background: var(--bg-900);
  cursor: default;
}

.issue-editor-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Editor form */
.issue-editor-grid {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.issue-editor-composer {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.issue-editor-body-shell {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  width: 100%;
}

.issue-editor-tool-rail {
  flex: 0 0 30px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.issue-editor-tool-rail .icon-button {
  flex-shrink: 0;
}

/* Title input */
.issue-editor-title-input {
  border: 1px solid var(--bg-600);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  font-size: 0.92rem;
  font-weight: 500;
  font-family: inherit;
  background: var(--bg-800);
  color: var(--bg-50);
  outline: none;
  width: 100%;
  transition: border-color 0.15s ease;
}

.issue-editor-title-input:focus {
  border-color: var(--accent-primary);
}
.issue-editor-title-input::placeholder {
  color: var(--bg-400);
}

.issue-editor-title-input--composer {
  flex: 1 1 auto;
  min-width: 0;
}

.issue-editor-send-btn {
  flex-shrink: 0;
  background: color-mix(in srgb, var(--accent-primary) 16%, var(--bg-800));
  color: color-mix(in srgb, var(--accent-primary) 78%, white);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}

.issue-editor-send-btn svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
}

.issue-editor-send-btn:not(:disabled) {
  color: var(--accent-primary);
  border-color: color-mix(in srgb, var(--accent-primary) 68%, var(--bg-600));
  box-shadow: 0 0 0 1px
    color-mix(in srgb, var(--accent-primary) 26%, transparent) inset;
}

.issue-editor-send-btn:not(:disabled):hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--bg-950);
}

.issue-editor-send-btn:not(:disabled):active {
  transform: scale(0.96);
}

.issue-editor-send-btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.issue-editor-dictation-btn {
  flex-shrink: 0;
  color: var(--bg-200);
}

.issue-editor-dictation-btn svg {
  width: 0.95rem;
  height: 0.95rem;
}

.issue-editor-dictation-btn.is-recording {
  color: var(--accent-danger);
  border-color: color-mix(in srgb, var(--accent-danger) 70%, var(--bg-600));
  box-shadow: 0 0 0 1px
    color-mix(in srgb, var(--accent-danger) 20%, transparent) inset;
}

.issue-editor-dictation-btn.is-working {
  color: var(--accent-primary);
  border-color: color-mix(in srgb, var(--accent-primary) 70%, var(--bg-600));
  opacity: 0.76;
}

/* Meta rows with pill selectors */
.issue-editor-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
}

.issue-editor-meta-row--new-issue {
  width: 100%;
}

.issue-editor-meta-grid--editing {
  width: 100%;
  display: grid;
  grid-template-columns: 30px max-content minmax(0, 1fr) max-content 30px;
  column-gap: 1rem;
  row-gap: 0.45rem;
  align-items: start;
  margin-bottom: 0.16rem;
}

.issue-editor-meta-row--editing {
  display: contents;
}

.issue-editor-meta-row--editing-primary {
  width: 100%;
}

.issue-editor-meta-row--editing-secondary {
  width: 100%;
}

.issue-editor-field-inline {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  min-width: 0;
}

.issue-editor-field-inline--priority-end {
  margin-left: auto;
}

.issue-editor-field-cluster {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex-wrap: wrap;
}

.issue-editor-field-cluster--editing-left {
  grid-column: 2 / 4;
  justify-self: start;
}

.issue-editor-field-inline--editing-left {
  grid-column: 2;
}

.issue-editor-field-inline--editing-right {
  grid-column: 4;
}

.issue-editor-field-label {
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bg-300);
  flex-shrink: 0;
}

.issue-editor-actions--editing-start {
  display: flex;
  align-items: center;
  grid-column: 1;
  justify-self: start;
  position: relative;
  min-height: 30px;
}

.issue-editor-actions--editing-end {
  display: flex;
  align-items: center;
  grid-column: 5;
  justify-self: end;
}

.issue-editor-lock-indicator {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--bg-250);
  opacity: 0.86;
  pointer-events: none;
}

.issue-editor-lock-indicator svg {
  width: 14px;
  height: 14px;
}

/* Pill selectors */
.pill-selector {
  display: flex;
  gap: 3px;
  align-items: center;
}

.category-pill,
.priority-pill,
.status-pill {
  border: 1px solid var(--bg-600);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  background: transparent;
  color: var(--bg-100);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    color 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}

.category-pill:hover,
.priority-pill:hover,
.status-pill:hover {
  border-color: var(--bg-100);
  color: var(--bg-50);
}

/* Category pills selected */
.category-pill.is-selected {
  background: rgba(248, 250, 252, 0.1);
  box-shadow: 0 0 0 1px currentColor inset;
}

.category-pill[data-category="bugfixes"].is-selected {
  color: var(--accent-danger);
  border-color: var(--accent-danger);
}
.category-pill[data-category="improvements"].is-selected {
  color: var(--accent-success);
  border-color: var(--accent-success);
}
.category-pill[data-category="features"].is-selected {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}
.category-pill[data-category="maintenance"].is-selected {
  color: var(--accent-warning);
  border-color: var(--accent-warning);
}
.category-pill[data-category="planning"].is-selected {
  color: var(--accent-info);
  border-color: var(--accent-info);
}

/* Priority pills selected */
.priority-pill.is-selected {
  background: rgba(248, 250, 252, 0.1);
  box-shadow: 0 0 0 1px currentColor inset;
}

.priority-pill[data-priority="P0"].is-selected {
  color: var(--accent-danger);
  border-color: var(--accent-danger);
}
.priority-pill[data-priority="P1"].is-selected {
  color: var(--accent-warning);
  border-color: var(--accent-warning);
}
.priority-pill[data-priority="P2"].is-selected {
  color: var(--accent-info);
  border-color: var(--accent-info);
}

.recurring-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  width: 30px;
  height: 18px;
}

.recurring-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.recurring-toggle-track {
  position: relative;
  display: inline-flex;
  width: 30px;
  height: 16px;
  border: 1px solid var(--bg-600);
  border-radius: 999px;
  background: var(--bg-800);
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.recurring-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-300);
  transition:
    background-color 0.15s ease,
    transform 0.15s ease;
}

.recurring-toggle:hover .recurring-toggle-track,
.recurring-toggle-input:focus-visible + .recurring-toggle-track {
  border-color: var(--bg-100);
}

.recurring-toggle-input:checked + .recurring-toggle-track {
  border-color: var(--accent-info);
  background: color-mix(in srgb, var(--accent-info) 28%, var(--bg-800));
}

.recurring-toggle-input:checked
  + .recurring-toggle-track
  .recurring-toggle-thumb {
  background: var(--accent-info);
  transform: translateX(14px);
}

/* Status pills selected */
.status-pill.is-selected {
  background: var(--bg-50);
  color: var(--bg-900);
  border-color: var(--bg-50);
}

/* Dependencies multi-select */
.deps-field {
  position: relative;
}

.deps-selector {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.deps-dropdown-wrapper {
  position: relative;
}

.deps-add-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--bg-600);
  background: transparent;
  color: var(--bg-150);
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.deps-add-btn:hover {
  background: var(--bg-600);
  color: var(--bg-50);
}

.deps-tag {
  display: inline-flex;
  align-items: stretch;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--bg-100);
  border: 1px solid var(--bg-400);
  border-radius: 4px;
  overflow: hidden;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.deps-tag:hover {
  border-color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary) 15%, transparent);
}

.deps-tag:focus-within {
  border-color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary) 15%, transparent);
}

.deps-tag-main {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.1;
  padding: 0.12rem 0.4rem;
  cursor: pointer;
}

.deps-tag-main:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: -2px;
}

.deps-tag-remove {
  appearance: none;
  border: none;
  border-left: 1px solid var(--bg-400);
  background: transparent;
  color: var(--accent-danger);
  font: inherit;
  font-size: 0.7rem;
  line-height: 1;
  padding: 0 0.35rem;
  cursor: pointer;
  opacity: 0.7;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
}

.deps-tag-remove:hover,
.deps-tag-remove:focus-visible {
  background: color-mix(in srgb, var(--accent-danger) 15%, transparent);
  color: var(--accent-danger);
  opacity: 1;
}

.deps-dropdown {
  background: var(--bg-900);
  border: 1px solid var(--bg-600);
  border-radius: 6px;
  padding: 4px;
  min-width: 220px;
  width: min(320px, calc(100vw - 4rem));
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.deps-dropdown--floating {
  position: fixed;
}

.deps-option {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 4px 8px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.72rem;
  color: var(--bg-100);
  transition: background 0.1s ease;
}

.deps-option:hover {
  background: var(--bg-600);
}

.deps-option.is-selected {
  background: color-mix(in srgb, var(--accent-primary) 20%, transparent);
  color: var(--accent-primary);
}

.deps-option-id {
  font-weight: 700;
  flex-shrink: 0;
}

.deps-option-title {
  color: var(--bg-200);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Body textarea */
.issue-editor-body {
  border: 1px solid var(--bg-600);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  background: var(--bg-800);
  color: var(--bg-50);
  resize: vertical;
  min-height: 72px;
  min-width: 0;
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease;
}

.issue-editor-body:focus {
  border-color: var(--accent-primary);
}
.issue-editor-body::placeholder {
  color: var(--bg-400);
}

.issue-editor-body--markdown {
  min-height: 132px;
  padding: 0.65rem 0.7rem;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.55;
}

/* === Raw Editor === */

.raw-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
  min-height: 0;
}

.raw-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.raw-editor-title {
  font-weight: 600;
  font-size: 0.88rem;
}

.raw-textarea {
  flex: 1;
  border: 1px solid var(--bg-600);
  border-radius: 6px;
  padding: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  background: var(--bg-800);
  color: var(--bg-50);
  resize: none;
  outline: none;
  min-height: 300px;
}

.raw-textarea:focus {
  border-color: var(--accent-primary);
}

.raw-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

/* === Toast Notifications === */

.toast-container {
  position: fixed;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  pointer-events: none;
}

.toast {
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--bg-800);
  border: 1px solid var(--bg-600);
  color: var(--bg-50);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.2s ease;
  pointer-events: auto;
}

.toast--success {
  border-color: var(--accent-success);
}
.toast--error {
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Empty / Loading States === */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: var(--bg-300);
  gap: 0.75rem;
}

.empty-state .message {
  font-size: 0.85rem;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--bg-600);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status-message {
  text-align: center;
  padding: 2rem;
  color: var(--bg-300);
  font-size: 0.85rem;
}

/* === Responsive === */

/*
 * Issue cards are single-line: [Title…] [Tags].
 * The title truncates as space shrinks; tags stay inline.
 * Only phones (<500px) need the toolbar to wrap and
 * editor meta to stack. Cards never reflow.
 */

@media (max-width: 500px) {
  .app-container {
    padding: 0 0.5rem;
  }
  .toolbar {
    flex-wrap: wrap;
  }
  .toolbar-divider {
    display: none;
  }
  .search-input {
    max-width: none;
    min-width: 100%;
    order: -1;
  }
  .issue-meta-separator {
    display: none;
  }
  .issue-editor-meta-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .issue-editor-meta-grid--editing {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 0.16rem;
  }
  .issue-editor-meta-row--editing {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    align-items: center;
  }
  .issue-editor-actions--editing-end {
    margin-left: auto;
  }
  .issue-editor-actions--editing-start {
    position: static;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    min-height: 0;
  }
  .issue-editor-lock-indicator {
    position: static;
    transform: none;
  }
  .issue-editor-field-inline--priority-end {
    margin-left: 0;
  }
  .pill-selector {
    flex-wrap: wrap;
  }
}

/* ─── Git Ops Button & Popover ─── */

/* ─── PR Status Badge ─── */

.btn-pr-link {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  color: var(--accent-primary, #60a5fa);
  text-decoration: none;
  border: 1px solid var(--accent-primary, #60a5fa);
  border-radius: 6px;
  transition: opacity 0.15s;
}

.btn-pr-link:hover {
  opacity: 0.8;
}

.push-indicator {
  font-size: 0.7rem;
  color: var(--bg-200, #9ca3af);
  opacity: 0.8;
}

.push-error {
  font-size: 0.7rem;
  color: #f87171;
  cursor: help;
}

/* ─── Flow Panel (right side) ─── */

.flow-panel {
  width: 210px;
  position: sticky;
  top: 0.35rem;
  align-self: start;
  justify-self: end;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  animation: flow-slide-in 0.25s ease-out;
}

@keyframes flow-slide-in {
  from {
    opacity: 0;
    transform: translateX(1rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.flow-section {
  background: var(--bg-900);
  border: 1px solid var(--bg-600);
  border-radius: 10px;
  padding: 0.85rem;
}

.flow-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--bg-100);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.flow-steps {
  display: flex;
  flex-direction: column;
}

.flow-step-group {
  display: flex;
  flex-direction: column;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--bg-600);
  background: var(--bg-800);
  transition: all 0.3s ease;
}

.flow-step--pending {
  border-color: var(--bg-600);
  color: var(--bg-300);
}

.flow-step--running {
  border-color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary) 12%, var(--bg-800));
  color: var(--accent-primary);
}

.flow-step--completed {
  border-color: var(--accent-success);
  background: color-mix(in srgb, var(--accent-success) 10%, var(--bg-800));
  color: var(--accent-success);
}

.flow-step--failed {
  border-color: var(--accent-danger);
  background: color-mix(in srgb, var(--accent-danger) 12%, var(--bg-800));
  color: var(--accent-danger);
}

.flow-step--skipped {
  border-color: var(--bg-600);
  opacity: 0.45;
}

.flow-step-icon {
  font-size: 0.8rem;
  line-height: 1;
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
}

.flow-step-label {
  font-size: 0.68rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flow-connector {
  width: 1px;
  height: 10px;
  background: var(--bg-600);
  margin-left: 1rem;
  flex-shrink: 0;
}

.flow-connector--done {
  background: var(--accent-success);
}

.flow-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: flow-spin 0.8s linear infinite;
}

@keyframes flow-spin {
  to {
    transform: rotate(360deg);
  }
}

.flow-summary {
  font-size: 0.68rem;
  color: var(--bg-200);
  margin-top: 0.5rem;
  line-height: 1.3;
}

.flow-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

@media (max-width: 980px) {
  .app-container--with-flow {
    max-width: 960px;
  }

  .workspace-shell--with-flow {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.75rem;
  }

  .flow-panel {
    width: 100%;
    position: static;
  }
}

/* === Login Screen === */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
  background: var(--bg-800);
  border: 1px solid var(--bg-600);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-card h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--bg-50);
  margin: 0;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--bg-300);
  margin: 0;
}

.login-github-logo {
  color: var(--bg-100);
}

.login-btn {
  margin-top: 0.5rem;
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
}

/* === GitHub Menu (Avatar Dropdown) === */

.github-menu {
  position: relative;
  flex-shrink: 0;
}

.repo-selection-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: transparent;
}

.settings-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 260;
  background: rgba(15, 17, 20, 0.72);
}

.settings-modal {
  position: fixed;
  top: 4rem;
  left: 50%;
  z-index: 270;
  display: flex;
  width: min(24rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  flex-direction: column;
  transform: translateX(-50%);
  overflow: hidden;
  border: 1px solid var(--bg-600);
  border-radius: 8px;
  background: var(--bg-900);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.55);
}

.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--bg-600);
}

.settings-modal-header h2 {
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--bg-50);
}

.settings-modal-close {
  width: 26px;
  height: 26px;
}

.settings-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0.85rem;
}

.settings-account-row {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--bg-600);
  border-radius: 6px;
  background: var(--bg-800);
}

.settings-account-label {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--bg-150);
}

.settings-account-login {
  min-width: 0;
  overflow: hidden;
  color: var(--bg-50);
  font-size: 0.8rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-logout-button {
  justify-content: center;
  border-color: color-mix(in srgb, var(--accent-danger) 72%, var(--bg-600));
  color: var(--accent-danger);
}

.settings-logout-button:hover {
  border-color: var(--accent-danger);
  background: color-mix(in srgb, var(--accent-danger) 18%, transparent);
  color: var(--bg-50);
}

.github-avatar-btn {
  background: none;
  border: 2px solid var(--bg-600);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease;
}

.github-avatar-btn:hover {
  border-color: var(--accent-primary);
}

.user-avatar {
  border-radius: 50%;
  display: block;
}

.github-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  background: var(--bg-900);
  border: 1px solid var(--bg-600);
  border-radius: 8px;
  min-width: 280px;
  max-width: 340px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
}

.github-dropdown--required {
  min-width: 320px;
}

.github-dropdown-header {
  padding: 0.5rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--bg-100);
  border-bottom: 1px solid var(--bg-600);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.github-dropdown-identity {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.15rem;
}

.github-dropdown-note {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--bg-300);
}

.github-settings-btn {
  width: 26px;
  height: 26px;
}

.repo-search {
  margin: 0.4rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--bg-600);
  border-radius: 6px;
  background: var(--bg-800);
  color: var(--bg-50);
  font-size: 0.78rem;
  font-family: inherit;
  outline: none;
}

.repo-search:focus {
  border-color: var(--accent-primary);
}

.repo-search::placeholder {
  color: var(--bg-400);
}

.repo-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 0.25rem;
}

.repo-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.55rem;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 5px;
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--bg-100);
  transition: background 0.1s ease;
  gap: 0.5rem;
}

.repo-option:hover {
  background: var(--bg-600);
}

.repo-option.is-active {
  background: color-mix(in srgb, var(--accent-primary) 20%, transparent);
  color: var(--accent-primary);
}

.repo-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repo-private {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bg-300);
  background: var(--bg-800);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  flex-shrink: 0;
}

.repo-loading,
.repo-empty {
  padding: 1rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--bg-300);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn-small {
  padding: 0.2rem 0.5rem;
  font-size: 0.68rem;
}
