/* ─── Back Link ─────────────────────────────────────────────────── */
.issue-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-gray-theme);
  margin-bottom: var(--space-5);
  transition: color var(--transition-fast);
  text-decoration: none;
}
.issue-back:hover {
  color: var(--color-text-theme);
}

/* ─── Issue Header ──────────────────────────────────────────────── */
.issue-header {
  margin-bottom: var(--space-7, 28px);
}

.issue-header .issue-id {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-gray-theme);
  margin-bottom: var(--space-2);
  letter-spacing: 0.2px;
}

.issue-title-text {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text-theme);
  line-height: 1.3;
  cursor: text;
  transition: color var(--transition-fast);
}
.issue-title-text:hover {
  color: var(--color-accent);
}

.issue-title-input {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  width: 100%;
  line-height: 1.3;
}

/* ─── Two-Column Layout ─────────────────────────────────────────── */
.issue-layout {
  display: grid;
  grid-template-columns: 1fr 296px;
  gap: var(--space-8);
  align-items: start;
}

/* ─── Main Content ──────────────────────────────────────────────── */
.issue-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.issue-section {
  padding: var(--space-5) var(--space-6);
}

.section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-gray-theme);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.edit-hint {
  font-size: var(--text-xs);
  font-weight: var(--weight-normal);
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-accent);
  opacity: 0.7;
}

.issue-desc-text {
  font-size: var(--text-base);
  color: var(--color-text-theme);
  line-height: 1.65;
  cursor: text;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast),
    background var(--transition-fast);
  white-space: pre-wrap;
  min-height: 2.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-md, 4px);
  border: 1px solid transparent;
}
.issue-desc-text:not(.readonly):hover {
  border-color: var(--color-accent);
  background: var(--color-bg-hover, rgba(255, 255, 255, 0.04));
}
.issue-desc-text:not(.readonly):empty::before,
.issue-desc-text:not(.readonly)[data-empty]::before {
  content: 'Click to add a description…';
  color: var(--color-text-muted, #6b7280);
  font-style: italic;
}
.issue-desc-text.readonly {
  cursor: default;
  padding: 0.375rem 0.5rem;
}

.issue-result-text {
  font-size: var(--text-base);
  color: var(--color-text-theme);
  line-height: 1.65;
  white-space: pre-wrap;
}

/* ─── Audit Log Timeline ────────────────────────────────────────── */
.audit-log {
  display: flex;
  flex-direction: column;
}

.audit-entry {
  display: flex;
  gap: var(--space-4);
  position: relative;
  padding-bottom: var(--space-4);
}

.audit-entry:last-child {
  padding-bottom: 0;
}

.audit-entry::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 15px;
  bottom: 0;
  width: 1px;
  background: var(--color-border);
}

.audit-entry:last-child::before {
  display: none;
}

.audit-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--color-background-theme);
  border: 2px solid var(--color-border-strong);
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
  z-index: 1;
}

.audit-entry-new .audit-dot {
  border-color: var(--color-accent);
  background: var(--color-accent);
}

.audit-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 0;
}

.audit-action {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-theme);
}

.audit-meta {
  font-size: var(--text-xs);
  color: var(--color-text-gray-theme);
}

/* Specific status dot colors for the audit log timeline */
.audit-dot.audit-dot-open {
  background: var(--status-open-bg);
  border-color: var(--status-open);
}
.audit-dot.audit-dot-in-progress {
  background: var(--status-in-progress-bg);
  border-color: var(--status-in-progress);
}
.audit-dot.audit-dot-review {
  background: var(--status-pending-review-bg);
  border-color: var(--status-pending-review);
}
.audit-dot.audit-dot-blocked {
  background: var(--status-blocked-bg);
  border-color: var(--status-blocked);
}
.audit-dot.audit-dot-closed {
  background: var(--status-closed-bg);
  border-color: var(--status-closed);
}

/* Inline assignee input: match the .sidebar-editable sizing so there's no layout jump */
#assignee-input {
  width: 100%;
  font-size: var(--text-sm);
  padding: var(--space-1, 4px) var(--space-2, 8px);
  min-height: 28px;
  box-sizing: border-box;
}

/* ─── Sidebar ───────────────────────────────────────────────────── */
.issue-sidebar {
  background: var(--color-background-theme);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-field {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.sidebar-field:last-child {
  border-bottom: none;
}

.sidebar-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-gray-theme);
  margin-bottom: var(--space-2);
}

.sidebar-select {
  width: 100%;
  font-size: var(--text-sm);
}

.sidebar-editable {
  font-size: var(--text-sm);
  color: var(--color-text-theme);
  cursor: text;
  display: block;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 4px);
  padding: var(--space-1, 4px) var(--space-2, 8px);
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast);
  min-height: 28px;
}
.sidebar-editable:hover {
  border-color: var(--color-accent);
  background: var(--color-bg);
}

.sidebar-kv {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-1);
}

/* ─── Token Progress Bar ────────────────────────────────────────── */
.token-bar {
  width: 110px;
  height: 5px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
  margin: 0;
}

.token-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 280ms ease;
}

.token-bar-fill.token-bar-over {
  background: var(--color-danger);
}

.token-bar-label {
  font-size: var(--text-xs);
  color: var(--color-text-gray-theme);
  text-align: right;
}

.token-cell {
  vertical-align: middle;
  min-width: 120px;
}

.token-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.token-text {
  font-size: var(--text-xs);
  margin-bottom: 4px;
}

.token-fill.token-ok {
  background: var(--status-open);
}

.token-fill.token-warn {
  background: var(--status-in-progress);
}

.token-fill.token-over {
  background: var(--status-blocked);
}

/* ─── Not-found fallback ────────────────────────────────────────── */
.not-found-msg {
  padding: var(--space-10) 0;
  color: var(--color-text-gray-theme);
  font-size: var(--text-sm);
}

/* ─── Sidebar Action ────────────────────────────────────────────── */
.sidebar-action {
  padding: var(--space-5);
}

.action-btn {
  width: 100%;
  justify-content: center;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
  font-size: var(--text-sm);
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Multiple stacked action buttons in the sidebar */
.sidebar-action {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* Approve & Close uses success color */
.btn-success {
  background: var(--status-open) !important;
  border-color: var(--status-open) !important;
  color: #ffffff !important;
}
.btn-success:hover {
  background: #15803d !important;
  border-color: #15803d !important;
}

/* Created-by sidebar field */
.sidebar-created-by {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-created-by .created-by-icon {
  font-size: 16px;
}

/* State banner (blocked / closed) */
.state-banner-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
}

.state-banner-icon {
  display: flex;
}

.state-banner-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--color-text-theme);
}

.state-banner-sub {
  font-size: var(--text-sm);
  color: var(--color-text-gray-theme);
  margin-top: 2px;
}

.banner-blocked {
  border-left: 4px solid var(--status-blocked);
  background: var(--status-blocked-bg);
}

.banner-closed {
  border-left: 4px solid var(--status-closed);
  background: var(--status-closed-bg);
}
