/* ==========================================================================
   JiraPilot Design System
   Inspired by DocGenie · Aladin Technology Enterprise Design Language
   Palette: Deep Forest Green (#1d4d35), Emerald (#16a34a), Clean Minimalist
   Typography: Geist & Geist Mono
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700;800&family=Geist+Mono:wght@400;500;600;700&display=swap');

:root {
  /* DocGenie Brand Greens & Palette */
  --g1: #1d4d35;
  --g2: #16a34a;
  --g3: #14532d;
  --tint: #f1f7f3;
  --soft: #f7f8f7;
  --soft-hover: #f0f4f1;
  --bg: #ffffff;
  --sidebar-bg: #fafbfa;
  --card-bg: #ffffff;
  --surface: #ffffff;

  /* Crisp Enterprise Borders */
  --line: #e6e9e7;
  --line2: #d5e5da;
  --line3: #e3e7e4;
  --line-focus: #1d4d35;

  /* Typography Colors */
  --text: #1c2420;
  --muted: #6b746f;
  --sub: #5b6660;
  --dim: #8a938e;

  /* Priority Tokens */
  --prio-highest: #dc2626;
  --prio-high: #ea580c;
  --prio-medium: #d97706;
  --prio-low: #2563eb;

  /* Issue Type Tokens */
  --badge-bug-fg: #b42318;
  --badge-bug-bg: #fef3f2;
  --badge-bug-border: #fecdca;

  --badge-task-fg: #1d4ed8;
  --badge-task-bg: #eff6ff;
  --badge-task-border: #bfdbfe;

  --badge-subtask-fg: #6b21a8;
  --badge-subtask-bg: #faf5ff;
  --badge-subtask-border: #e9d5ff;

  --badge-story-fg: #0e7490;
  --badge-story-bg: #ecfeff;
  --badge-story-border: #a5f3fc;

  /* Status Tokens */
  --status-todo-fg: #475467;
  --status-todo-bg: #f2f4f7;
  --status-todo-border: #e4e7ec;

  --status-progress-fg: #b54708;
  --status-progress-bg: #fffaeb;
  --status-progress-border: #fedf89;

  --status-done-fg: #027a48;
  --status-done-bg: #ecfdf3;
  --status-done-border: #abefc6;

  /* Fonts */
  --font-sans: 'Geist', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Radii & Shadows */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 12px rgba(20, 40, 30, 0.06);
  --shadow-lg: 0 8px 24px rgba(20, 40, 30, 0.1);
  --shadow-popover: 0 12px 28px rgba(20, 40, 30, 0.14);
}

/* Dark Mode (DocGenie Night Palette) */
html[data-theme="dark"] {
  --g1: #2f7a52;
  --g2: #22c55e;
  --g3: #1b5336;
  --tint: #163126;
  --soft: #18231e;
  --soft-hover: #1f2e27;
  --bg: #121a16;
  --sidebar-bg: #0d1411;
  --card-bg: #151e19;
  --surface: #18231e;

  --line: #24352d;
  --line2: #2b5240;
  --line3: #203128;
  --line-focus: #34d399;

  --text: #e6efe9;
  --muted: #9fb3a8;
  --sub: #b2c2b9;
  --dim: #6e8277;

  --badge-bug-fg: #fca5a5;
  --badge-bug-bg: rgba(220, 38, 38, 0.18);
  --badge-bug-border: rgba(220, 38, 38, 0.35);

  --badge-task-fg: #93c5fd;
  --badge-task-bg: rgba(37, 99, 235, 0.18);
  --badge-task-border: rgba(37, 99, 235, 0.35);

  --badge-subtask-fg: #d8b4fe;
  --badge-subtask-bg: rgba(124, 92, 191, 0.18);
  --badge-subtask-border: rgba(124, 92, 191, 0.35);

  --badge-story-fg: #67e8f9;
  --badge-story-bg: rgba(8, 145, 178, 0.18);
  --badge-story-border: rgba(8, 145, 178, 0.35);

  --status-todo-fg: #cbd5e1;
  --status-todo-bg: rgba(71, 84, 103, 0.25);
  --status-todo-border: rgba(100, 116, 139, 0.3);

  --status-progress-fg: #fde047;
  --status-progress-bg: rgba(180, 83, 9, 0.25);
  --status-progress-border: rgba(245, 158, 11, 0.35);

  --status-done-fg: #86efac;
  --status-done-bg: rgba(2, 122, 72, 0.25);
  --status-done-border: rgba(34, 197, 94, 0.35);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 26px rgba(0, 0, 0, 0.5);
  --shadow-popover: 0 14px 32px rgba(0, 0, 0, 0.6);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--g1);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--g3);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ==========================================================================
   App Shell Layout (DocGenie Aside + Topbar + Content)
   ========================================================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* Sidebar */
.app-sidebar {
  width: 250px;
  flex: none;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: width 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
}

/* ==========================================================================
   Sidebar Collapsed State (Professional, compact 64px mode)
   ========================================================================== */
.app-sidebar.collapsed {
  width: 64px;
}

/* Header in collapsed mode */
.app-sidebar.collapsed .sidebar-header {
  padding: 12px 6px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.app-sidebar.collapsed .brand-wrapper {
  justify-content: center;
  width: 100%;
}

.app-sidebar.collapsed .brand-text-col {
  display: none !important;
}

.app-sidebar.collapsed .sidebar-collapse-btn {
  margin: 0 auto;
}

.app-sidebar.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

/* Scope Pill in collapsed mode */
.app-sidebar.collapsed .sidebar-scope {
  padding: 8px 6px;
  position: relative;
  z-index: 50;
}

.app-sidebar.collapsed .scope-pill {
  padding: 8px 0;
  justify-content: center;
  width: 100%;
  height: 38px;
  border-radius: var(--radius-md);
}

.app-sidebar.collapsed .scope-pill-left {
  gap: 0;
  justify-content: center;
}

.app-sidebar.collapsed .scope-pill .scope-title,
.app-sidebar.collapsed .scope-pill .scope-type,
.app-sidebar.collapsed .scope-pill > svg {
  display: none !important;
}

.app-sidebar.collapsed .scope-dot {
  width: 10px;
  height: 10px;
}

/* Scope Popover in collapsed mode: flyout to the right */
.app-sidebar.collapsed .scope-menu {
  position: fixed;
  left: 70px;
  top: 60px;
  width: 260px;
  right: auto;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22), 0 0 0 1px var(--line2);
  z-index: 1000;
}

/* Active Project Card in collapsed mode */
.app-sidebar.collapsed .active-project-card {
  margin: 4px 4px 8px;
  padding: 6px 2px;
  text-align: center;
}

.app-sidebar.collapsed .active-proj-top,
.app-sidebar.collapsed .active-proj-meta {
  display: none !important;
}

.app-sidebar.collapsed .active-proj-title {
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 2px;
}

/* Section titles in collapsed mode */
.app-sidebar.collapsed .nav-section-title {
  display: none !important;
}

.app-sidebar.collapsed .sidebar-nav {
  padding: 6px 6px 14px;
  gap: 10px;
}

.app-sidebar.collapsed .sidebar-nav > div {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 2px;
}

.app-sidebar.collapsed .sidebar-nav > div:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

/* Nav links in collapsed mode */
.app-sidebar.collapsed .nav-item-link {
  padding: 9px 0;
  justify-content: center;
  border-radius: var(--radius-md);
  position: relative;
}

.app-sidebar.collapsed .nav-label {
  display: none !important;
}

.app-sidebar.collapsed .nav-icon {
  width: 20px;
  height: 20px;
  margin: 0;
}

.app-sidebar.collapsed .nav-icon svg {
  width: 17px;
  height: 17px;
}

.app-sidebar.collapsed .nav-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 8.5px;
  padding: 0 3px;
  height: 14px;
  line-height: 14px;
  min-width: 14px;
  text-align: center;
  border-radius: 7px;
}

/* Sidebar footer in collapsed mode */
.app-sidebar.collapsed .sidebar-footer {
  padding: 10px 6px;
}

.app-sidebar.collapsed .user-profile-row {
  justify-content: center;
  margin-bottom: 8px;
  padding: 0;
}

.app-sidebar.collapsed .user-info-text {
  display: none !important;
}

.app-sidebar.collapsed .user-avatar-circle {
  margin: 0 auto;
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.app-sidebar.collapsed .sidebar-tools-row {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 6px;
}

.app-sidebar.collapsed .theme-toggle-btn,
.app-sidebar.collapsed .mini-action-btn {
  width: 36px;
  height: 30px;
  padding: 0;
  justify-content: center;
}

.app-sidebar.collapsed #theme-text,
.app-sidebar.collapsed .mini-action-btn span {
  display: none !important;
}

/* Sidebar Brand Header */
.sidebar-header {
  padding: 16px 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
}

.brand-logo-sq {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--g1) 0%, var(--g2) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-shadow: 0 2px 8px rgba(29, 77, 53, 0.25);
  color: #ffffff;
}

.brand-text-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: opacity 0.15s;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-name {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
  letter-spacing: -0.2px;
}

.brand-badge-pill {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--g1);
  background: var(--tint);
  border: 1px solid var(--line2);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-collapse-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--dim);
  transition: all 0.15s;
  flex: none;
}

.sidebar-collapse-btn:hover {
  background: var(--soft-hover);
  border-color: var(--line);
  color: var(--text);
}

/* Workspace / Scope Selector Card */
.sidebar-scope {
  padding: 10px 12px;
  position: relative;
  z-index: 50;
}

.scope-pill {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: var(--card-bg);
  border: 1px solid var(--line3);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
}

.scope-pill:hover {
  border-color: var(--line2);
  background: var(--tint);
}

.scope-pill-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.scope-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--g2);
  flex: none;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.scope-dot-project { background: #10b981; }
.scope-dot-all { background: var(--g1); }
.text-g1 { color: var(--g1) !important; }
.text-default { color: var(--text) !important; }

.scope-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scope-type {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* Navigation Groups */
.sidebar-nav {
  flex: 1;
  padding: 8px 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-section-title {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 6px 10px 4px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--sub);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
  position: relative;
}

.nav-item-link:hover {
  color: var(--text);
  background: var(--soft-hover);
  text-decoration: none;
}

.nav-item-link.active {
  background: var(--tint);
  color: var(--g1);
  font-weight: 600;
}

.nav-item-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--g2);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--line3);
  color: var(--muted);
}

.nav-item-link.active .nav-badge {
  background: var(--line2);
  color: var(--g1);
}

/* Active Project Scope Card in Sidebar */
.active-project-card {
  margin: 4px 6px 12px;
  padding: 9px 11px;
  background: var(--tint);
  border: 1px solid var(--line2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.active-proj-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.active-proj-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--g1);
}

.active-proj-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  border: 1px solid var(--line3);
  transition: all 0.15s;
}

.active-proj-back-btn:hover {
  color: var(--text);
  background: var(--soft-hover);
  border-color: var(--line);
  text-decoration: none;
}

.active-proj-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.active-proj-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--muted);
}

/* Nav Project Sublist */
.nav-project-sublist {
  padding-left: 2px;
}

.nav-project-link {
  padding: 5px 10px;
  font-size: 12px;
}

.nav-project-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
  flex: none;
  transition: background 0.15s;
}

.nav-project-link:hover .nav-project-dot {
  background: var(--g1);
}

.nav-project-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  gap: 6px;
}

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

.nav-project-key {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--dim);
  flex: none;
}

/* Sidebar Footer & User Profile */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-profile-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.user-avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--tint);
  border: 1px solid var(--line2);
  color: var(--g1);
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.user-info-text {
  min-width: 0;
  flex: 1;
}

.user-name-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-caption {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

.theme-toggle-btn, .mini-action-btn {
  height: 26px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--card-bg);
  border: 1px solid var(--line3);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.theme-toggle-btn:hover, .mini-action-btn:hover {
  background: var(--soft-hover);
  color: var(--text);
  border-color: var(--line2);
}

/* ==========================================================================
   Main Pane & Sticky Topbar (DocGenie Style)
   ========================================================================== */

.app-main-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.app-topbar {
  height: 44px;
  flex: none;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}

/* Breadcrumbs */
.topbar-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.crumb-root {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.crumb-root:hover {
  color: var(--text);
  text-decoration: underline;
}

.crumb-sep {
  color: var(--dim);
  font-size: 12px;
}

.crumb-current {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.crumb-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  background: var(--tint);
  border: 1px solid var(--line2);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  color: var(--g1);
  margin-left: 4px;
}

.crumb-pill-dot {
  font-size: 7px;
  color: var(--g2);
}

/* Topbar Actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

/* AI Model Badge in Topbar */
.ai-model-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px;
  background: var(--soft);
  border: 1px solid var(--line3);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  color: var(--text);
}

.ai-model-pill b {
  color: var(--g1);
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--g2);
  display: inline-block;
  animation: dgPulse 2s infinite ease-in-out;
}

@keyframes dgPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* Sync Button */
.btn-sync-topbar {
  height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--g1);
  color: #ffffff;
  border: 1px solid var(--g3);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-sync-topbar:hover {
  background: var(--g3);
}

/* Notification Bell & Dropdown */
.topbar-notif-wrap {
  position: relative;
}

.btn-bell {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line3);
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  color: var(--sub);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-bell:hover {
  background: var(--soft-hover);
  border-color: var(--line2);
  color: var(--text);
}

.notif-badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  background: #f59e0b;
  color: #1c2420;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 1px solid var(--bg);
}

.notif-dropdown {
  position: absolute;
  right: 0;
  top: 36px;
  width: 320px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-popover);
  z-index: 50;
  display: none;
}

.notif-dropdown.show {
  display: block;
}

.notif-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-item {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s;
}

.notif-item:hover {
  background: var(--soft);
}

.notif-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.notif-item-meta {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* ==========================================================================
   Page Content Container & Notifications Banner
   ========================================================================== */

.page-body {
  flex: 1;
  padding: 16px 20px 48px;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
}

.alert-banner-docgenie {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: var(--tint);
  border: 1px solid var(--line2);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--g1);
}

/* Page Title Row */
.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.page-main-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.page-desc-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

/* ==========================================================================
   DocGenie KPI Metrics Grid (Clean 6-Card Block)
   ========================================================================== */

.kpi-grid-docgenie {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.kpi-card {
  padding: 11px 14px;
  border: 1px solid var(--line3);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-card:hover {
  border-color: var(--line2);
  background: var(--soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.kpi-card.active {
  border-color: var(--g1);
  background: var(--tint);
}

.kpi-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-value {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  margin-top: 4px;
  line-height: 1.1;
}

.kpi-sub {
  font-size: 10.5px;
  color: var(--dim);
  margin-top: 4px;
}

/* ==========================================================================
   Filter & Toolbar Controls (DocGenie Design)
   ========================================================================== */

.docgenie-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--line3);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.view-mode-toggle {
  display: inline-flex;
  padding: 2px;
  background: var(--soft);
  border: 1px solid var(--line3);
  border-radius: var(--radius-md);
  gap: 2px;
}

.view-btn {
  height: 26px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--sub);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: all 0.12s;
}

.view-btn:hover {
  color: var(--text);
  text-decoration: none;
}

.view-btn.active {
  background: var(--card-bg);
  color: var(--g1);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.filter-chip-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-chip {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line3);
  border-radius: var(--radius-pill);
  background: var(--card-bg);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--sub);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: all 0.12s;
}

.filter-chip:hover {
  background: var(--soft-hover);
  color: var(--text);
  border-color: var(--line2);
  text-decoration: none;
}

.filter-chip.active {
  background: var(--tint);
  border-color: var(--line2);
  color: var(--g1);
  font-weight: 600;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.docgenie-select {
  height: 30px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line3);
  border-radius: var(--radius-sm);
  background-color: var(--card-bg);
  font-size: 12px;
  color: var(--text);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b746f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s;
}

.docgenie-select:focus {
  border-color: var(--line-focus);
}

.docgenie-search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  background: var(--card-bg);
  border: 1px solid var(--line3);
  border-radius: var(--radius-sm);
  width: 240px;
  transition: border-color 0.15s;
}

.docgenie-search-box:focus-within {
  border-color: var(--line-focus);
  box-shadow: 0 0 0 2px rgba(29, 77, 53, 0.08);
}

.docgenie-search-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  color: var(--text);
  width: 100%;
}

.docgenie-search-input::placeholder {
  color: var(--dim);
}

/* ==========================================================================
   Table View (DocGenie Data Grid)
   ========================================================================== */

.docgenie-table-container {
  border: 1px solid var(--line3);
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.docgenie-table-header {
  display: grid;
  grid-template-columns: 110px 100px 1fr 110px 130px 160px;
  gap: 12px;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.docgenie-table-row {
  display: grid;
  grid-template-columns: 110px 100px 1fr 110px 130px 160px;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  transition: background 0.12s;
}

.docgenie-table-row:last-child {
  border-bottom: none;
}

.docgenie-table-row:hover {
  background: var(--soft);
}

/* Cells */
.cell-key {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
}

.cell-key a {
  color: var(--g1);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cell-key a:hover {
  color: var(--g3);
  text-decoration: underline;
}

.cell-summary-wrap {
  min-width: 0;
}

.cell-summary-title {
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-summary-title a {
  color: inherit;
  text-decoration: none;
}

.cell-summary-title a:hover {
  color: var(--g1);
  text-decoration: underline;
}

.cell-summary-project {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

/* Badges */
.badge-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.badge-bug {
  background: var(--badge-bug-bg);
  color: var(--badge-bug-fg);
  border: 1px solid var(--badge-bug-border);
}

.badge-task {
  background: var(--badge-task-bg);
  color: var(--badge-task-fg);
  border: 1px solid var(--badge-task-border);
}

.badge-subtask {
  background: var(--badge-subtask-bg);
  color: var(--badge-subtask-fg);
  border: 1px solid var(--badge-subtask-border);
}

.badge-story {
  background: var(--badge-story-bg);
  color: var(--badge-story-fg);
  border: 1px solid var(--badge-story-border);
}

/* Priority Cell */
.priority-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--sub);
}

.prio-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.prio-dot-highest { background: var(--prio-highest); }
.prio-dot-high { background: var(--prio-high); }
.prio-dot-medium { background: var(--prio-medium); }
.prio-dot-low { background: var(--prio-low); }
.prio-dot-lowest { background: var(--prio-low); }
.prio-dot-done { background: var(--status-done-fg); }

.hidden {
  display: none !important;
}

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-todo {
  background: var(--status-todo-bg);
  color: var(--status-todo-fg);
  border: 1px solid var(--status-todo-border);
}

.status-in-progress {
  background: var(--status-progress-bg);
  color: var(--status-progress-fg);
  border: 1px solid var(--status-progress-border);
}

.status-done {
  background: var(--status-done-bg);
  color: var(--status-done-fg);
  border: 1px solid var(--status-done-border);
}

/* Action Buttons */
.table-actions-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.btn-docgenie {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.12s;
  white-space: nowrap;
}

.btn-docgenie-ghost {
  background: transparent;
  color: var(--sub);
  border: 1px solid var(--line3);
}

.btn-docgenie-ghost:hover {
  background: var(--soft-hover);
  color: var(--text);
  border-color: var(--line2);
  text-decoration: none;
}

.btn-docgenie-primary {
  background: var(--g1);
  color: #ffffff;
  border: 1px solid var(--g3);
}

.btn-docgenie-primary:hover {
  background: var(--g3);
  text-decoration: none;
}

.btn-docgenie-ai {
  background: var(--tint);
  color: var(--g1);
  border: 1px solid var(--line2);
  font-weight: 600;
}

.btn-docgenie-ai:hover {
  background: var(--line2);
  color: var(--g3);
  text-decoration: none;
}

/* ==========================================================================
   Kanban Board View (DocGenie Board Architecture)
   ========================================================================== */

.docgenie-board-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .docgenie-board-grid {
    grid-template-columns: 1fr;
  }
}

.board-column {
  background: var(--soft);
  border: 1px solid var(--line3);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 480px;
}

.board-col-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
}

.board-col-count {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  background: var(--card-bg);
  border: 1px solid var(--line3);
  border-radius: var(--radius-pill);
  color: var(--muted);
}

.board-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.board-task-card {
  background: var(--card-bg);
  border: 1px solid var(--line3);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.board-task-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--line2);
  transform: translateY(-1px);
}

.board-task-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.board-task-key {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--g1);
}

.board-task-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.board-task-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.board-task-user {
  display: flex;
  align-items: center;
  gap: 6px;
}

.board-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--tint);
  border: 1px solid var(--line2);
  color: var(--g1);
  font-size: 9.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Task Detail Page (DocGenie 2-Column Specs & AI Runner)
   ========================================================================== */

.task-detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  align-items: flex-start;
}

@media (max-width: 992px) {
  .task-detail-grid {
    grid-template-columns: 1fr;
  }
}

.docgenie-card {
  background: var(--card-bg);
  border: 1px solid var(--line3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.docgenie-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.desc-pre-content {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* AI Autonomous Runner Box (DocGenie Emerald / High-Tech) */
.ai-pilot-runner-card {
  background: var(--card-bg);
  border: 1px solid var(--line2);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}

.ai-pilot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.ai-pilot-brand-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-runner-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--g1) 0%, var(--g2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 8px rgba(29, 77, 53, 0.25);
}

.pipeline-step-list {
  background: var(--soft);
  border: 1px solid var(--line3);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.pipeline-step-list ol {
  margin-left: 20px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.8;
}

.pipeline-step-list strong {
  color: var(--text);
}

/* Live Terminal Output */
.docgenie-terminal {
  background: #0f1612;
  border: 1px solid #1e3328;
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #4ade80;
  display: none;
  margin-top: 14px;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1e3328;
  padding-bottom: 8px;
  margin-bottom: 10px;
  font-size: 11px;
  color: #86efac;
}

.terminal-body {
  white-space: pre-wrap;
  line-height: 1.6;
}

/* Metadata Field List (Right Column) */
.meta-field-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.meta-field-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-field-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.meta-field-value {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}

/* Scope Dropdown Menu */
.scope-dropdown-wrapper {
  position: relative;
  width: 100%;
}

.scope-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--line2);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16), 0 0 0 1px var(--line2);
  z-index: 100;
  display: none;
}

.scope-menu.show {
  display: block !important;
}

.scope-menu-items {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.scope-menu-item {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: 11.5px;
  transition: background 0.12s;
  display: block;
}

.scope-menu-item:hover {
  background: var(--soft);
  text-decoration: none;
}

.scope-menu-item.active {
  background: var(--tint);
  color: var(--g1);
  font-weight: 600;
}

/* Project Header Bar */
.project-header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 26, 22, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-container {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-popover);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--text);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--dim);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  transition: all 0.12s;
}

.modal-close-btn:hover {
  color: var(--text);
  background: var(--soft-hover);
}

.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--soft);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
}

.form-input {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line3);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: var(--line-focus);
  box-shadow: 0 0 0 2px rgba(29, 77, 53, 0.08);
}

.form-textarea {
  padding: 8px 10px;
  border: 1px solid var(--line3);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  font-size: 12px;
  outline: none;
  min-height: 60px;
  resize: vertical;
  line-height: 1.5;
  transition: border-color 0.15s;
}

.form-textarea:focus {
  border-color: var(--line-focus);
  box-shadow: 0 0 0 2px rgba(29, 77, 53, 0.08);
}

.form-hint {
  font-size: 10.5px;
  color: var(--dim);
}

/* Footer */
.app-footer {
  margin-top: auto;
  padding: 16px 20px;
  text-align: center;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 11.5px;
  background: var(--bg);
}
