@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg: #0d1117;
  --bg-soft: #161b22;
  --card: #21262d;
  --card-muted: #30363d;
  --text: #c9d1d9;
  --muted: #8b949e;
  --border: #30363d;
  --accent: #58a6ff;
  --accent-soft: rgba(56, 139, 253, 0.15);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 1.5rem 2rem 2rem;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  flex: 1;
}

.brand-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.categories-section {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.categories-section h2 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pinned-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.pinned-section.hidden {
  display: none;
}

.pinned-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text);
}

.pinned-issues {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.5rem;
}

.pinned-issues .issue-card {
  background: var(--card-muted);
}

.archived-btn {
  background: transparent;
  border: 1px solid transparent;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}

.archived-btn:hover {
  background: var(--bg-soft);
  border-color: var(--border);
}

.archived-btn.hidden {
  display: none;
}

.archived-btn .stat-value {
  color: var(--muted);
}

.archived-btn:hover .stat-value {
  color: var(--text);
}

.archived-dialog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  max-width: 480px;
  width: 90vw;
  max-height: 70vh;
  color: var(--text);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.archived-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.dialog-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.dialog-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  line-height: 1;
}

.dialog-close:hover {
  color: var(--text);
  background: transparent;
}

.archived-dialog .archived-issues {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  max-height: calc(70vh - 120px);
  overflow-y: auto;
}

.archived-dialog .hint {
  padding: 1rem 1.25rem;
  text-align: center;
  margin: 0;
}

/* Notifications dialog */
.notifications-dialog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  max-width: 420px;
  width: 90vw;
  color: var(--text);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.notifications-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.notifications-setup {
  padding: 1rem 1.25rem 1.5rem;
}

.notifications-setup > p {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.setup-step {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}

.step-number {
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
}

.step-content strong {
  display: block;
  margin-bottom: 0.25rem;
}

.step-content .hint {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
}

.install-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.install-link:hover {
  text-decoration: underline;
}

.notifications-status {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--bg-soft);
  border-radius: 6px;
  text-align: center;
}

.notifications-status.hidden {
  display: none;
}

.archived-card {
  background: var(--bg-soft);
  padding: 0.6rem 0.75rem;
  opacity: 0.9;
}

.archived-card:hover {
  opacity: 1;
}

.archived-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.restore-btn {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.restore-btn:hover {
  background: var(--accent);
  color: #fff;
}

.trash-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.trash-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

.logo {
  display: none;
}

.eyebrow {
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0 0 0.25rem;
}

h1 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 62ch;
}

.badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-weight: 500;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.pill.muted {
  color: var(--muted);
}

.header-actions {
  display: grid;
  gap: 0.85rem;
  width: 360px;
}

.action-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.token-callout,
.callout,
.saml-help {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  color: var(--muted);
  font-weight: 500;
}

.token-callout strong,
.callout strong {
  color: var(--text);
  font-size: 1.02rem;
}

.token-callout button {
  width: 100%;
}

.issue-stats {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.issue-stats.hidden {
  display: none;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.token-login {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.token-login summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
}

.token-login summary:hover {
  color: var(--accent);
}

.token-login[open] summary {
  margin-bottom: 0.6rem;
}

.token-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.token-input-row input {
  flex: 1;
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
}

.token-input-row button {
  flex-shrink: 0;
  font-size: 0.9rem;
  padding: 0.55rem 0.9rem;
}

.token-login .hint {
  font-size: 0.8rem;
  margin-top: 0.4rem;
}

.token-login .hint code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.callout.aside {
  background: var(--card-muted);
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.dot.warning {
  background: #fbbf24;
}

.callout-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

button,
select,
input {
  font: inherit;
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 0.55rem 0.85rem;
  background: var(--bg-soft);
  color: var(--text);
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.2s ease;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  background: #5558e3;
}

button:active:not(:disabled) {
  background: #4c4fd6;
}

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button.ghost.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

button.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
}

button.ghost.active:hover:not(:disabled) {
  background: rgba(56, 139, 253, 0.25);
}

input:disabled,
select:disabled {
  background: rgba(255, 255, 255, 0.04);
  cursor: not-allowed;
}

main.layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  position: static;
}

.panel-header h2 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.25rem 0 0.65rem;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.category-pill,
.pill {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-weight: 500;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.category-pill button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0;
  line-height: 1;
  font-size: 0.85rem;
  cursor: pointer;
}

.category-pill button:hover {
  color: var(--accent);
}

.inline {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.inline input {
  flex: 1;
}

.stacked {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.board-shell {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 1rem;
}

.board-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.board-controls-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.board-controls label {
  font-weight: 600;
  color: var(--muted);
}

.board-controls input {
  flex: 1;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.repo-filters {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.repo-filter-btn {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.repo-filter-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.repo-filter-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

.repo-filter-btn.reset {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.3);
  color: #fbbf24;
}

.repo-filter-btn.reset:hover {
  background: rgba(251, 191, 36, 0.2);
  border-color: rgba(251, 191, 36, 0.5);
}

.board {
  display: flex;
  gap: 0.9rem;
  align-items: start;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: fit-content;
}

.column {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 280px;
  flex-shrink: 0;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.column-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.count-badge {
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  font-weight: 600;
  font-size: 0.8rem;
}

.column-items {
  display: grid;
  gap: 0.7rem;
}

.issue-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
}

.issue-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.issue-title-group {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.issue-card .title {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.issue-card .title:hover {
  color: var(--accent);
}

.issue-meta {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  flex-wrap: wrap;
  row-gap: 0.15rem;
}

.issue-meta .repo {
  font-weight: 600;
  color: var(--accent);
}

.linked-issues {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.1rem;
}

.linked-issue {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-decoration: none;
  padding: 0.15rem 0.4rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 4px;
  transition: all 0.15s ease;
}

.linked-issue:hover {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.linked-icon {
  font-size: 0.7rem;
}

.status-pill {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  padding: 0;
  font-size: 0;
  border: none;
  background: #a5b4fc;
}

.status-pill.new-issue {
  background: #86efac;
}

.status-pill.new-activity {
  background: #a5b4fc;
}

.status-pill.mentioned {
  background: #fcd34d;
}

.issue-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 2rem;
}

.move-control {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.75rem;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}

.ai-control {
  display: flex;
  align-items: flex-end;
}

.move-control select {
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  background: var(--bg-soft);
  width: 100%;
  max-width: 100%;
}

/* Custom AI dropdown */
.ai-dropdown {
  position: relative;
}

.ai-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
}

.ai-dropdown-trigger:hover {
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(139, 92, 246, 0.1);
  color: #c4b5fd;
}

.ai-dropdown-trigger:disabled {
  opacity: 0.6;
  cursor: wait;
}

.ai-dropdown-trigger.loading {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.dropdown-caret {
  opacity: 0.6;
}

.ai-dropdown-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem;
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
  min-width: 120px;
}

.ai-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}

.ai-option:hover {
  background: rgba(139, 92, 246, 0.15);
}

.ai-option svg {
  flex-shrink: 0;
  color: #c4b5fd;
}

.issue-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.ai-badge {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-end;
}

.ai-badge-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.ai-badge-item svg {
  flex-shrink: 0;
}

.mark-seen {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.3);
  font-weight: 700;
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

.mark-seen:hover {
  background: rgba(34, 197, 94, 0.25);
  border-color: rgba(34, 197, 94, 0.5);
  color: #4ade80;
}

.saml-help {
  margin-bottom: 1rem;
}

.saml-help.hidden {
  display: none;
}

.saml-help p {
  margin: 0.5rem 0;
  color: var(--muted);
  line-height: 1.6;
}

.saml-help a {
  color: var(--accent);
}

.saml-help button {
  background: #fbbf24;
  color: #09090b;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
}

.saml-help button:hover {
  background: #f59e0b;
}

/* Issue Preview Panel */
.issue-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 200;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.issue-panel-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.issue-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 560px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
  transform: translateX(0);
  transition: transform 0.25s ease;
}

.issue-panel.hidden {
  transform: translateX(100%);
  pointer-events: none;
}

.issue-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.issue-panel-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.issue-panel-repo {
  font-weight: 600;
  color: var(--accent);
}

.issue-panel-number {
  color: var(--muted);
}

.issue-panel-state {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.issue-panel-state.open {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.issue-panel-state.closed {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.issue-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.issue-panel-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.issue-panel-link:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.issue-panel-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  line-height: 1;
  border-radius: 6px;
}

.issue-panel-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.issue-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.issue-panel-title {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.issue-panel-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.issue-label {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.issue-panel-body {
  color: var(--text);
  line-height: 1.65;
  font-size: 0.9rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.issue-panel-body:empty {
  display: none;
}

.issue-panel-body:empty + .issue-panel-comments {
  border-top: none;
}

/* Markdown body styles */
.markdown-body {
  word-wrap: break-word;
}

.markdown-body p {
  margin: 0 0 1rem;
}

.markdown-body p:last-child {
  margin-bottom: 0;
}

.markdown-body a {
  color: var(--accent);
}

.markdown-body code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.markdown-body pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin: 0 0 1rem;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
}

.markdown-body blockquote {
  margin: 0 0 1rem;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}

.markdown-body li {
  margin-bottom: 0.25rem;
}

.markdown-body img {
  max-width: 100%;
  border-radius: 6px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 1.5rem 0 0.75rem;
  font-weight: 600;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child {
  margin-top: 0;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.markdown-body th {
  background: var(--bg-soft);
  font-weight: 600;
}

/* Comments section */
.issue-panel-comments {
  padding-top: 0;
}

.comments-header {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comment-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

.comment-author {
  font-weight: 600;
  color: var(--text);
}

.comment-date {
  color: var(--muted);
}

.comment-body {
  padding: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

.no-comments {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* Loading state */
.issue-panel-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--bg);
  color: var(--muted);
}

.issue-panel-loading.hidden {
  display: none;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Panel Layout with Sidebar */
.issue-panel-body-wrapper {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.issue-panel-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.issue-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.issue-panel-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--card);
  border-left: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-section-title {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Assignees */
.assignees-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.assignee-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
}

.assignee-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.assignee-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--card-muted);
  flex-shrink: 0;
}

.assignee-name {
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignee-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.assignee-remove:hover {
  opacity: 1;
  color: #f87171;
  background: transparent;
}

.assignee-add {
  position: relative;
}

.assignee-add input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  background: var(--bg-soft);
}

.assignee-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.assignee-suggestions.hidden {
  display: none;
}

.assignee-suggestion {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.1s ease;
}

.assignee-suggestion:hover {
  background: var(--bg-soft);
}

.assignee-suggestion img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.no-assignees {
  color: var(--muted);
  font-size: 0.8rem;
  font-style: italic;
}

/* Sidebar Labels */
.sidebar-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.sidebar-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  max-width: 100%;
}

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

.sidebar-label-remove {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  flex-shrink: 0;
}

.sidebar-label-remove:hover {
  opacity: 1;
  background: transparent;
}

.label-add {
  position: relative;
}

.label-add input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  background: var(--bg-soft);
}

.label-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.label-suggestions.hidden {
  display: none;
}

.label-suggestion {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.1s ease;
}

.label-suggestion:hover {
  background: var(--bg-soft);
}

.label-suggestion-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.no-labels {
  color: var(--muted);
  font-size: 0.8rem;
  font-style: italic;
}

/* Comment Form */
.issue-panel-comment-form {
  border-top: 1px solid var(--border);
  padding: 1rem;
  background: var(--card);
  flex-shrink: 0;
}

.issue-panel-comment-form textarea {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.85rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
  min-height: 80px;
  max-height: 200px;
  font-family: inherit;
  color: var(--text);
}

.issue-panel-comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.issue-panel-comment-form textarea::placeholder {
  color: var(--muted);
}

.comment-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.comment-form-actions button {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.comment-form-actions button:disabled {
  opacity: 0.5;
}

@media (max-width: 1100px) {
  .page-header {
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .issue-panel {
    width: 100vw;
    max-width: 100vw;
  }
  
  .issue-panel-body-wrapper {
    flex-direction: column;
  }
  
  .issue-panel-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 150px;
  }
}

@media (min-width: 641px) and (max-width: 800px) {
  .issue-panel {
    width: 100vw;
    max-width: 100vw;
  }
}

@media (min-width: 801px) {
  .issue-panel {
    width: 720px;
  }
}
