:root {
  --bg: #0f1113;
  --bg-glow: #1a2424;
  --bg-strong: #0b0d0f;
  --glass: rgba(18, 24, 26, 0.78);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text: #f5f7f8;
  --muted: #9aa6b2;
  --accent: #00cc8f;
  --accent-dark: #237358;
  --accent-soft: rgba(0, 204, 143, 0.16);
  --shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
  --radius: 8px;
  --radius-sm: 4px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Manrope", sans-serif;
  --critical: #ff6b6b;
  --high: #f6c343;
  --medium: #63a9ff;
  --low: #7ae0a4;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.06);
  --surface-border: rgba(255, 255, 255, 0.08);
  --tag-bg: rgba(255, 255, 255, 0.06);
  --tag-border: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(7, 9, 10, 0.7);
  --input-border: rgba(255, 255, 255, 0.08);
  --outline-border: rgba(255, 255, 255, 0.18);
  --ghost-bg: rgba(255, 255, 255, 0.06);
  --chip-bg: rgba(255, 255, 255, 0.06);
  --backdrop: rgba(5, 6, 7, 0.7);
  --circle: rgba(0, 204, 143, 0.14);
  --logo-text: #0c1b17;
  --status-muted: #d4d4d4;
  --status-border: rgba(212, 212, 212, 0.25);
}

html[data-theme="light"] {
  --bg: #f3f6f5;
  --bg-glow: #f4fbf7;
  --bg-strong: #e4ece8;
  --glass: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(16, 25, 24, 0.08);
  --text: #152026;
  --muted: #5c6a75;
  --accent: #00b377;
  --accent-dark: #1c6a52;
  --accent-soft: rgba(0, 179, 119, 0.18);
  --shadow: 0 24px 45px rgba(18, 24, 26, 0.12);
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --surface-border: rgba(16, 25, 24, 0.1);
  --tag-bg: rgba(16, 25, 24, 0.06);
  --tag-border: rgba(16, 25, 24, 0.12);
  --input-bg: rgba(255, 255, 255, 0.9);
  --input-border: rgba(16, 25, 24, 0.16);
  --outline-border: rgba(16, 25, 24, 0.22);
  --ghost-bg: rgba(16, 25, 24, 0.06);
  --chip-bg: rgba(16, 25, 24, 0.08);
  --backdrop: rgba(16, 20, 24, 0.35);
  --circle: rgba(0, 179, 119, 0.1);
  --status-muted: #5a6670;
  --status-border: rgba(90, 102, 112, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background: radial-gradient(
    circle at top,
    var(--bg-glow) 0%,
    var(--bg) 45%,
    var(--bg-strong) 100%
  );
  color: var(--text);
}

body.next-sprint-open {
  overflow: hidden;
}

h1,
h2,
h3 {
  margin: 0 0 0.5rem 0;
  font-family: var(--font-display);
}

p {
  margin: 0;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

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

.small {
  font-size: 0.85rem;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.theme-toggle-track {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--tag-border);
  background: var(--tag-bg);
  position: relative;
}

.theme-toggle-thumb {
  position: absolute;
  top: 1px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.2s ease, background 0.2s ease;
}

html[data-theme="light"] .theme-toggle-thumb {
  transform: translateX(18px);
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

.circles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.circles li {
  position: absolute;
  list-style: none;
  width: 20px;
  height: 20px;
  background: var(--circle);
  animation: float 25s linear infinite;
  bottom: -150px;
  border-radius: 4px;
}

.circles li:nth-child(1) {
  left: 25%;
  width: 80px;
  height: 80px;
  animation-delay: 0s;
}

.circles li:nth-child(2) {
  left: 10%;
  width: 20px;
  height: 20px;
  animation-delay: 2s;
  animation-duration: 12s;
}

.circles li:nth-child(3) {
  left: 70%;
  width: 20px;
  height: 20px;
  animation-delay: 4s;
}

.circles li:nth-child(4) {
  left: 40%;
  width: 60px;
  height: 60px;
  animation-delay: 0s;
  animation-duration: 18s;
}

.circles li:nth-child(5) {
  left: 65%;
  width: 20px;
  height: 20px;
  animation-delay: 0s;
}

.circles li:nth-child(6) {
  left: 75%;
  width: 110px;
  height: 110px;
  animation-delay: 3s;
}

.circles li:nth-child(7) {
  left: 35%;
  width: 150px;
  height: 150px;
  animation-delay: 7s;
}

.circles li:nth-child(8) {
  left: 50%;
  width: 25px;
  height: 25px;
  animation-delay: 15s;
  animation-duration: 45s;
}

.circles li:nth-child(9) {
  left: 20%;
  width: 15px;
  height: 15px;
  animation-delay: 2s;
  animation-duration: 35s;
}

.circles li:nth-child(10) {
  left: 85%;
  width: 150px;
  height: 150px;
  animation-delay: 0s;
  animation-duration: 11s;
}

@keyframes float {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
    border-radius: 0;
  }
  100% {
    transform: translateY(-1000px) rotate(720deg);
    opacity: 0;
    border-radius: 50%;
  }
}

@keyframes fadeUp {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
}

.login-card {
  width: min(460px, 92vw);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeUp 0.6s ease;
}

.login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.login-language {
  align-items: flex-end;
}

.login-language span {
  font-size: 0.75rem;
  color: var(--muted);
}

.login-error {
  color: var(--critical);
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.35);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.brand-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  width: fit-content;
}

.app-shell {
  width: 100%;
  padding-bottom: 64px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Main 60/40 layout */
.main-layout {
  display: grid;
  grid-template-columns: 60% 40%;
  gap: 24px;
  width: 100%;
  flex: 1;
  min-height: 0;
  padding: 0 4vw;
  align-items: stretch;
  transition: grid-template-columns 0.3s ease;
}

.left-column {
  padding-right: 24px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.right-column {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100%;
  padding: 20px;
  padding-top: 60px;
  gap: 20px;
}

/* When incident is open, align content to top */
body.incident-open:not(.agent-open) .right-column {
  padding-top: 24px;
  align-items: stretch;
}

/* Speech bubble */
.speech-bubble {
  position: absolute;
  top: 180px;
  left: 0;
  transform: translateX(-20px);
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 12px 18px;
  border-radius: 20px 20px 20px 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  max-width: 200px;
  z-index: 20;
  animation: floatBubble 3s ease-in-out infinite, fadeUp 0.5s ease;
  cursor: pointer;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 20px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--glass);
}

/* Hide speech bubble when chat is open */
body.agent-open .speech-bubble {
  display: none;
}

@keyframes floatBubble {
  0%, 100% { transform: translateX(-20px) translateY(0); }
  50% { transform: translateX(-20px) translateY(-8px); }
}

.agent-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 520px;
}

body.agent-open .main-layout {
  grid-template-columns: 50% 50%;
}

/* When chat is open, place avatar stack left and chat right */
body.agent-open .right-column {
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 24px;
}

.add-incident-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 150;
  padding: 14px 24px;
  font-size: 1rem;
  box-shadow: 0 8px 24px rgba(0, 204, 143, 0.3);
}

.add-incident-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 204, 143, 0.4);
}

/* Create incident panel - floating modal style */
.panel.create {
  position: fixed;
  bottom: 90px;
  right: 30px;
  width: 400px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 140;
  animation: fadeUp 0.3s ease;
}

.panel.create.hidden {
  display: none !important;
}

.agent-shell {
  width: 100%;
  padding: 28px 4vw 16px;
  display: none; /* Hidden by default - avatar floats on right side */
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  transition: grid-template-columns 0.3s ease;
}

.agent-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.agent-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 520px;
  align-items: flex-start;
}

.agent-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
}

.agent-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.agent-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 900px;
  z-index: 10;
  border-radius: var(--radius);
  overflow: visible;
  cursor: pointer;
  transition: transform 0.35s ease, width 0.35s ease, box-shadow 0.35s ease;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#avatarCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background: transparent !important;
}

body.agent-open .agent-stack,
body.agent-open .agent-chat {
  flex: 1;
  max-width: none;
}

/* When chat is open, avatar shrinks to left side */
body.agent-open .agent-canvas-wrap {
  width: 200px;
  max-width: 200px;
  height: 400px;
  flex-shrink: 0;
}

body:not(.agent-open) .agent-canvas-wrap {
  margin-bottom: 0;
}

/* When an incident is open (but not chat), move avatar to bottom right and shrink */
body.incident-open:not(.agent-open) .agent-canvas-wrap {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 180px;
  height: 220px;
  max-width: 180px;
  z-index: 200;
  transform: scale(1);
  transition: all 0.4s ease;
  pointer-events: auto;
}

body.incident-open:not(.agent-open) .right-column {
  min-height: auto;
}

/* Detail panel takes full width when incident is open */
body.incident-open:not(.agent-open) .detail {
  flex: 1;
  width: 100%;
  max-width: 100%;
}

.agent-canvas-wrap:focus {
  outline: 2px solid rgba(0, 204, 143, 0.5);
  outline-offset: 2px;
}

.agent-canvas-wrap.active {
  /* No styling - keep transparent */
}

.agent-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  background: transparent;
  pointer-events: none;
}

.agent-chat {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  width: 100%;
  max-width: 520px;
  min-height: 360px;
  height: clamp(360px, 55vh, 560px);
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
}

.chat-title {
  font-weight: 600;
  font-size: 1.1rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px 4px 12px 0;
  min-height: 0;
}

.chat-message {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 20px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  line-height: 1.5;
  white-space: pre-wrap;
  font-size: 0.95rem;
  animation: fadeUp 0.3s ease;
}

.chat-message.agent {
  align-self: flex-start;
  border-radius: 20px 20px 20px 6px;
}

.chat-message.agent.typing {
  padding: 16px 20px;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.chat-message.user {
  align-self: flex-end;
  border-color: rgba(0, 204, 143, 0.4);
  background: rgba(0, 204, 143, 0.15);
  backdrop-filter: blur(12px);
  border-radius: 20px 20px 6px 20px;
}

/* Ticket links in chat messages */
.chat-message .ticket-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  padding: 2px 8px;
  background: var(--accent-soft);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.chat-message .ticket-link:hover {
  background: var(--accent);
  color: white;
  text-decoration: none;
}

.chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chat-attachments img {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
}

.chat-attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  font-size: 0.75rem;
}

.chat-upload-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
}

.chat-upload-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-upload-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 0.8rem;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.chat-upload-remove:hover {
  background: rgba(255, 100, 100, 0.2);
  color: #ff6464;
}

.chat-uploads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px;
}

.chat-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--glass);
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  margin-top: auto;
}

.chat-input textarea {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  resize: none;
  min-height: 20px;
}

.chat-input textarea:focus {
  outline: none;
}

.chat-upload {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
}

.chat-input .button {
  flex-shrink: 0;
}

.chat-uploads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

body.agent-open .agent-chat {
  display: flex;
}

.topbar {
  width: 100%;
  margin: 0 0 24px;
  padding: 16px 4vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-radius: 0;
  animation: fadeUp 0.6s ease;
}

.logo {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--logo-text);
  background: linear-gradient(135deg, var(--accent), #52f2b6);
}

.logo-mark-img {
  width: 23px;
  height: 23px;
  border-radius: 7px;
  object-fit: cover;
}

.logo-title {
  font-weight: 600;
}

.logo-sub {
  font-size: 0.85rem;
}

.logo-sub.jira-error {
  color: #d64545;
  font-weight: 600;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sync-block {
  text-align: right;
  margin-right: 6px;
}

.sync-time {
  font-weight: 600;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--surface-border);
  font-weight: 600;
}

.user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.user-email {
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0.8;
}

.icon-button {
  border: 1px solid var(--outline-border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 204, 143, 0.5);
}

.dashboard {
  display: none; /* No longer used - replaced by main-layout */
}

.panel {
  padding: 24px;
  border-radius: var(--radius);
  animation: fadeUp 0.6s ease;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 6px;
}

.incident-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.incident-card {
  padding: 18px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s ease, border 0.2s ease;
  animation: fadeUp 0.5s ease both;
  animation-delay: var(--delay, 0s);
}

.incident-card.is-new {
  border-color: rgba(0, 204, 143, 0.75);
  box-shadow: 0 0 0 1px rgba(0, 204, 143, 0.2);
}

.incident-card.is-done {
  background: rgba(0, 204, 143, 0.08);
  border-color: rgba(0, 204, 143, 0.25);
}

.incident-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 204, 143, 0.4);
}

.incident-card.active {
  border-color: rgba(0, 204, 143, 0.9);
  box-shadow: 0 12px 30px rgba(0, 204, 143, 0.15);
}

.incident-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.incident-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.incident-new-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--logo-text);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.incident-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--tag-border);
  background: var(--tag-bg);
}

.tag.severity-critical {
  color: var(--critical);
  border-color: rgba(255, 107, 107, 0.35);
}

.tag.severity-high {
  color: var(--high);
  border-color: rgba(246, 195, 67, 0.35);
}

.tag.severity-medium {
  color: var(--medium);
  border-color: rgba(99, 169, 255, 0.35);
}

.tag.severity-low {
  color: var(--low);
  border-color: rgba(122, 224, 164, 0.35);
}

.tag.status-closed,
.tag.status-not-fixed {
  color: var(--status-muted);
  border-color: var(--status-border);
}

.side-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Incident detail panel in right column */
.detail {
  min-height: 320px;
  width: 100%;
  max-width: none;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}

/* When detail is not hidden, it will display via removing hidden class */
.detail:not(.hidden) {
  display: flex;
  flex-direction: column;
}

/* Hide speech bubble when incident detail is open (but not chat) */
body.incident-open:not(.agent-open) .speech-bubble {
  display: none;
}

.detail-empty {
  color: var(--muted);
  text-align: center;
  padding: 40px 20px;
}

.detail-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: -20px -20px 16px -20px;
  padding: 20px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 10;
}

.detail-title {
  font-size: 1.3rem;
  font-weight: 600;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
}

.detail-grid {
  display: grid;
  gap: 16px;
}

.detail-block {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  overflow: hidden;
}

.detail-block h4 {
  margin: 0 0 8px 0;
  font-size: 0.95rem;
}

.text-block {
  white-space: normal;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  font-size: 0.95rem;
  color: var(--text);
}

.text-block p {
  margin: 0 0 12px;
}

.text-block p:last-child {
  margin-bottom: 0;
}

.text-block ul,
.text-block ol {
  margin: 8px 0 12px 20px;
  padding: 0;
}

.text-block li {
  margin-bottom: 6px;
}

.text-block h1,
.text-block h2,
.text-block h3,
.text-block h4 {
  margin: 12px 0 8px;
  font-family: var(--font-display);
}

.text-block blockquote {
  margin: 12px 0;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.text-block pre {
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.text-block code {
  font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
}

.text-block table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.text-block th,
.text-block td {
  border: 1px solid var(--surface-border);
  padding: 8px;
  text-align: left;
}

.text-block a {
  color: var(--accent);
  text-decoration: underline;
}

.screenshots {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.screenshots img {
  width: 120px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.comment-item {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--surface-border);
}

.comment-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}

.field input,
.field textarea,
.field select {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: rgba(0, 204, 143, 0.6);
  box-shadow: 0 0 0 2px rgba(0, 204, 143, 0.2);
}

.field.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.field.checkbox input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.helper {
  font-size: 0.78rem;
  color: var(--muted);
}

.select-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
}

.language-select select {
  min-width: 140px;
}

.panel-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
}

.view-toggle-button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.view-toggle-button:hover {
  color: var(--text);
}

.view-toggle-button.active {
  background: var(--accent);
  color: var(--logo-text);
}

.search-row {
  width: 100%;
  margin-bottom: 16px;
}

.search-count {
  margin-top: 6px;
}

.admin-shell {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 24px;
}

.admin-panel {
  width: min(1100px, 100%);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.admin-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
}

.admin-row {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
  background: var(--surface);
}

.admin-error {
  padding: 6px 0;
}

.filters-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.filter-dropdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.filter-trigger {
  width: 100%;
  min-width: 0;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.filter-trigger:focus {
  outline: none;
  border-color: rgba(0, 204, 143, 0.6);
  box-shadow: 0 0 0 2px rgba(0, 204, 143, 0.2);
}

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

.filter-chevron {
  font-size: 0.8rem;
  opacity: 0.7;
}

.filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 8px;
  max-height: 220px;
  overflow-y: auto;
  display: none;
  z-index: 10;
}

.filter-dropdown.open .filter-menu {
  display: block;
}

.filter-option label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
}

.filter-option label:hover {
  background: var(--surface);
}

.filter-option input {
  accent-color: var(--accent);
}

.search-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  width: 100%;
}

.search-field input {
  width: 100%;
  min-width: 0;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
}

.search-field input:focus {
  outline: none;
  border-color: rgba(0, 204, 143, 0.6);
  box-shadow: 0 0 0 2px rgba(0, 204, 143, 0.2);
}

.select-field select {
  min-width: 180px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.select-field select[multiple] {
  min-height: 120px;
  padding: 8px 10px;
}

.button {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button.cta {
  background: var(--accent);
  color: #0c1b17;
  box-shadow: 0 12px 24px rgba(0, 204, 143, 0.2);
}

.button.cta:hover {
  background: #07e2a2;
  transform: translateY(-1px);
}

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

.button.outline:hover {
  border-color: rgba(0, 204, 143, 0.6);
}

.button.ghost {
  background: var(--ghost-bg);
  color: var(--text);
}

.button.ghost:hover {
  background: rgba(0, 204, 143, 0.18);
}

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

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.screenshot-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.screenshot-preview img {
  width: 72px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
  object-fit: cover;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
}

.modal-card {
  position: relative;
  width: min(480px, 92vw);
  padding: 24px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeUp 0.3s ease;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.next-sprint-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 28px 4vw;
}

.next-sprint-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  z-index: 0;
}

.next-sprint-panel {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: calc(100vh - 56px);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

.next-sprint-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.next-sprint-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.next-sprint-count-pill {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(0, 204, 143, 0.25);
}

.next-sprint-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-right: 4px;
}

.next-sprint-card {
  border-bottom: 1px solid var(--surface-border);
  background: transparent;
  color: var(--text);
}

.next-sprint-row {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
}

.next-sprint-row:hover {
  background: var(--surface-strong);
}

.next-sprint-card.open .next-sprint-row {
  background: var(--surface-strong);
}

.next-sprint-row-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.next-sprint-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.next-sprint-type-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
}

.next-sprint-type-icon svg {
  width: 16px;
  height: 16px;
}

.next-sprint-type-icon.type-bug {
  color: #ff5c5c;
}

.next-sprint-type-icon.type-task {
  color: #4aa3ff;
}

.next-sprint-type-icon.type-incident {
  color: #ff9f43;
}

.next-sprint-type-icon.type-story {
  color: #8ad65f;
}

.next-sprint-type-icon.type-default {
  color: var(--surface-border);
}

.next-sprint-card-key {
  font-size: 0.9rem;
  font-weight: 600;
  color: #2d6cdf;
  text-decoration: underline;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 92px;
}

html[data-theme="light"] .next-sprint-card-key {
  color: #1d5fd1;
}

.next-sprint-card-title {
  font-weight: 500;
  min-width: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next-sprint-row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.next-sprint-card-meta {
  color: var(--muted);
}

.next-sprint-card-chevron {
  color: var(--muted);
  transition: transform 0.2s ease;
  font-size: 1.1rem;
}

.next-sprint-card.open .next-sprint-card-chevron {
  transform: rotate(180deg);
}

.next-sprint-card-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--surface-border);
  background: var(--surface-strong);
}

.next-sprint-empty {
  padding: 24px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px dashed var(--surface-border);
  color: var(--muted);
}

@media (max-width: 960px) {
  .app-shell {
    height: auto;
    overflow: visible;
  }

  .main-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 0 4vw 40px;
    min-height: 0;
  }

  body.agent-open .main-layout {
    grid-template-columns: 1fr;
  }

  .left-column {
    padding-right: 0;
    overflow: visible;
  }

  .right-column {
    align-items: stretch;
    padding: 0;
  }

  body.agent-open .right-column {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  body.agent-open .agent-stack {
    max-width: 100%;
  }

  .agent-canvas-wrap {
    max-width: 100%;
    height: clamp(220px, 36vh, 320px);
  }

  body.agent-open .agent-canvas-wrap {
    height: clamp(240px, 38vh, 360px);
  }

  .agent-chat {
    max-width: 100%;
    max-height: none;
  }

  body.agent-open .agent-chat {
    height: auto;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .sync-block {
    text-align: left;
    margin-right: 0;
  }

  .next-sprint-panel {
    max-height: calc(100vh - 40px);
    padding: 20px;
  }

  .next-sprint-header {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .panel-actions {
    width: 100%;
    align-items: stretch;
  }

  .search-field input {
    min-width: 100%;
  }

  .agent-canvas-wrap {
    height: clamp(200px, 32vh, 280px);
  }

  .theme-toggle {
    top: 12px;
    right: 12px;
    font-size: 0.78rem;
  }

  .panel {
    padding: 20px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .form-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .next-sprint-row {
    align-items: flex-start;
  }

  .next-sprint-card-key {
    white-space: normal;
  }

  .next-sprint-row-main {
    flex-wrap: wrap;
  }

  .next-sprint-card-title {
    white-space: normal;
  }
}
