:root {
  /* Default: Ultra Premium Dark Palette */
  --bg-app: #09090b;
  --bg-sidebar: #0f0f13;
  --bg-column: rgba(255, 255, 255, 0.02);
  --bg-card: rgba(255, 255, 255, 0.035);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.03);
  
  --text-primary: #ededed;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --accent-color: #5e6ad2;
  --accent-hover: #6975e8;
  
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(94, 106, 210, 0.15);

  --status-todo: #8b949e;
  --status-in-progress: #f1e05a;
  --status-resolved: #a371f7;
  --status-completed: #2ea043;
}

body.light-theme {
  --bg-app: #f4f5f7;
  --bg-sidebar: #ffffff;
  --bg-column: #ebecf0;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfcfc;
  --bg-input: #ffffff;
  
  --text-primary: #172b4d;
  --text-secondary: #5e6c84;
  --text-muted: #8993a4;
  
  --accent-color: #0052cc;
  --accent-hover: #0065ff;
  
  --border-subtle: #dfe1e6;
  --border-strong: #c1c7d0;
  
  --shadow-sm: 0 1px 2px rgba(9, 30, 66, 0.25);
  --shadow-md: 0 4px 12px -2px rgba(9, 30, 66, 0.25), 0 0 1px rgba(9, 30, 66, 0.31);
  --shadow-glow: 0 0 20px rgba(0, 82, 204, 0.15);

  --status-todo: #5e6c84;
  --status-in-progress: #ffab00;
  --status-resolved: #6554c0;
  --status-completed: #36b37e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

.sidebar {
  width: 240px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  z-index: 20;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s, border-color 0.3s;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar.collapsed {
  width: 72px;
  padding: 1.25rem 0.6rem;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

body:not(.light-theme) .main-content {
  background: radial-gradient(circle at 50% -20%, rgba(94, 106, 210, 0.05) 0%, transparent 40%);
}

#view-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  height: 100%;
}
.view-panel.active-view {
  display: flex;
}

/* Sidebar Styles */
.sidebar-header { margin-bottom: 2rem; padding: 0 0.5rem; display: flex; align-items: center; justify-content: space-between; position: relative; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 0; }
.logo { display: flex; align-items: center; gap: 0.75rem; font-weight: 600; font-size: 1rem; }
.logo-icon {
  flex-shrink: 0; background: linear-gradient(135deg, var(--accent-color), #8a94e6);
  color: #fff; width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(94, 106, 210, 0.4);
}

.sidebar-toggler {
  background: var(--bg-input); border: 1px solid var(--border-subtle);
  color: var(--text-muted); cursor: pointer; width: 24px; height: 24px;
  border-radius: 4px; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.sidebar-toggler:hover { background: var(--border-subtle); color: var(--text-primary); }
.sidebar.collapsed .sidebar-toggler { position: absolute; top: 40px; right: 50%; transform: translateX(50%); width: 20px; height: 20px; }

.sidebar-text {
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}
.sidebar.collapsed .sidebar-text {
  opacity: 0; visibility: hidden; position: absolute; transform: translateX(-10px);
}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem;
  color: var(--text-secondary); text-decoration: none; border-radius: 6px;
  font-weight: 500; transition: all 0.2s ease;
  overflow: hidden; min-width: 40px;
}
.sidebar.collapsed .nav-item { justify-content: center; padding: 0.5rem 0; gap: 0; }
.nav-item i { font-size: 1.1rem; flex-shrink: 0; }
.nav-item:hover { background-color: var(--border-subtle); color: var(--text-primary); }
.nav-item.active { background-color: var(--border-strong); color: var(--text-primary); }
.sidebar-footer { padding-top: 1rem; border-top: 1px solid var(--border-subtle); display:flex; flex-direction: column; gap: 0.5rem; }

/* Main Header */
.app-header {
  height: 64px; padding: 0 2rem; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--border-subtle);
  transition: border-color 0.3s;
}
.header-left, .header-right { display: flex; align-items: center; gap: 1.5rem; }
.page-title { font-size: 1.1rem; font-weight: 600; }
.search-bar {
  display: flex; align-items: center; background: var(--bg-input);
  border: 1px solid var(--border-subtle); border-radius: 6px;
  padding: 0.4rem 0.75rem; width: 280px; gap: 0.5rem; transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--border-strong); }
.search-bar i { color: var(--text-muted); }
.search-bar input {
  background: transparent; border: none; color: var(--text-primary);
  font-size: 0.85rem; width: 100%; outline: none;
}
.search-bar input::placeholder { color: var(--text-muted); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border-subtle); }

/* Buttons */
.btn {
  padding: 0.4rem 0.85rem; border-radius: 6px; font-size: 0.85rem;
  font-weight: 500; cursor: pointer; border: none; display: inline-flex;
  align-items: center; gap: 0.4rem; transition: all 0.2s ease;
}
.primary-btn { background-color: var(--accent-color); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.primary-btn:hover { background-color: var(--accent-hover); box-shadow: 0 4px 12px rgba(94, 106, 210, 0.3); }
.secondary-btn { background-color: transparent; color: var(--text-primary); border: 1px solid var(--border-strong); }
.secondary-btn:hover { background-color: var(--border-subtle); }

.icon-btn, .icon-btn-large {
  background: transparent; border: none; color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: all 0.2s; padding: 0.2rem;
}
.icon-btn:hover, .icon-btn.active { color: var(--text-primary); background: var(--border-subtle); }
.icon-btn i { font-size: 1.1rem; }
.icon-btn-large i { font-size: 1.4rem; }

/* Board Filters */
.board-filters {
  padding: 1rem 2rem; display: flex; align-items: center;
  border-bottom: 1px solid var(--border-subtle); gap: 1.5rem;
}
.filter-group {
  display: flex; background: var(--bg-input); border-radius: 6px;
  padding: 2px; border: 1px solid var(--border-subtle);
}
.filter-btn {
  background: transparent; border: none; color: var(--text-secondary);
  padding: 0.35rem 0.75rem; font-size: 0.8rem; font-weight: 500;
  cursor: pointer; border-radius: 4px; transition: all 0.2s;
}
.filter-btn:hover { color: var(--text-primary); background: rgba(0,0,0,0.05); }
.filter-btn.active {
  background: var(--border-subtle); color: var(--text-primary); box-shadow: var(--shadow-sm);
}
.filter-btn.with-icon { display: inline-flex; align-items: center; gap: 0.3rem; }

/* Kanban Board */
.board-container {
  display: flex; flex: 1; padding: 1.5rem 2rem; gap: 1.25rem;
  overflow-x: auto; align-items: flex-start;
}
.column {
  flex: 0 0 320px; display: flex; flex-direction: column;
  background: var(--bg-column); border-radius: 8px; max-height: 100%;
  transition: background-color 0.3s;
}
.column-header { padding: 1rem; display: flex; align-items: center; justify-content: space-between; }
.col-title { display: flex; align-items: center; gap: 0.5rem; }
.column-header h2 { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.issue-count { color: var(--text-muted); font-size: 0.75rem; margin-left: 0.25rem; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-todo { background-color: var(--status-todo); }
.status-in-progress { background-color: var(--status-in-progress); }
.status-resolved { background-color: var(--status-resolved); }
.status-completed { background-color: var(--status-completed); }

.column-body {
  padding: 0 1rem 1rem 1rem; flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.65rem;
}
.column-body.drag-over {
  background: var(--border-subtle); border-radius: 6px; outline: 1px dashed var(--border-strong);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Task Cards */
.issue-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: 6px; padding: 0.85rem; cursor: grab;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 0.5rem;
}
.issue-card:hover {
  background: var(--bg-card-hover); border-color: var(--border-strong);
  transform: translateY(-1px); box-shadow: var(--shadow-md);
}
.issue-card:active { cursor: grabbing; }
.issue-card.dragging { opacity: 0.4; transform: scale(0.98); }

.card-top { display: flex; justify-content: space-between; align-items: center; }
.issue-id { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.02em; }
.resolve-quick-btn { opacity: 0; padding: 2px; }
.issue-card:hover .resolve-quick-btn { opacity: 1; }

.issue-title { font-size: 0.9rem; font-weight: 500; line-height: 1.4; color: var(--text-primary); }
.issue-tags { display: flex; gap: 0.4rem; margin-top: 0.2rem; }
.tag {
  font-size: 0.65rem; padding: 0.15rem 0.4rem; border-radius: 4px;
  background: var(--border-subtle); color: var(--text-secondary);
}

.card-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 0.4rem; }
.priority-icon { color: var(--text-muted); font-size: 0.9rem; display: flex; }
.priority-icon.high { color: #f85149; }
.priority-icon.medium { color: #d29922; }
.priority-icon.low { color: #58a6ff; }
.assignee-avatar { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border-strong); }

/* Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(2px);
  display: flex; justify-content: center; align-items: center;
  z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.modal-overlay:not(.hidden) { opacity: 1; pointer-events: auto; }

.modal-content {
  background: var(--bg-sidebar); border: 1px solid var(--border-strong);
  border-radius: 12px; width: 100%; max-width: 540px; padding: 2rem;
  transform: scale(0.95) translateY(10px); transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-md);
}
.modal-overlay:not(.hidden) .modal-content { transform: scale(1) translateY(0); }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header h2 { font-size: 1.1rem; font-weight: 500; }

.form-group { margin-bottom: 1rem; }
.form-row { display: flex; gap: 1rem; margin-bottom: 1rem; }
.half { flex: 1; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.4rem; }

.input-large {
  width: 100%; border: none; background: transparent; color: var(--text-primary);
  font-size: 1.25rem; font-weight: 500; outline: none; padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle); transition: border-color 0.2s;
}
.input-large::placeholder { color: var(--text-muted); font-weight: 400; }
.input-large:focus { border-bottom-color: var(--accent-color); }

.input-body {
  width: 100%; border: 1px solid var(--border-subtle); background: var(--bg-input);
  color: var(--text-primary); border-radius: 6px; padding: 0.75rem; font-size: 0.9rem;
  resize: vertical; outline: none; transition: border-color 0.2s;
}
.input-body:focus { border-color: var(--accent-color); }

.select-input {
  width: 100%; border: 1px solid var(--border-subtle); background: var(--bg-input);
  color: var(--text-primary); border-radius: 6px; padding: 0.6rem; font-size: 0.85rem;
  outline: none; cursor: pointer; appearance: none;
}
.select-input:focus { border-color: var(--accent-color); }

.modal-actions {
  display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 2rem;
  padding-top: 1rem; border-top: 1px solid var(--border-subtle);
}

/* Toast */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-md);
  padding: 1rem 1.5rem; border-radius: 8px; z-index: 1000;
  transition: opacity 0.3s, transform 0.3s;
  display: flex; align-items: center; gap: 0.5rem;
}
.toast.hidden { opacity: 0; transform: translateY(20px); pointer-events: none; }

/* ---------------- New Elaborate Views & Animations ---------------- */

/* Generic Placeholder Helpers */
.page-padding { padding: 2rem; max-width: 1000px; margin: 0 auto; height: 100%; overflow-y: auto; }
.section-heading { font-size: 1.5rem; font-weight: 600; margin-bottom: 2rem; color: var(--text-primary); letter-spacing: -0.02em; }

/* Dashboard Styles */
.relative { position: relative; }
#dashboard-canvas {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}
.dashboard-content {
  position: relative; z-index: 10; padding: 2rem;
  max-width: 1200px; margin: 0 auto; width: 100%;
  height: 100%; overflow-y: auto;
}
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-bottom: 2.5rem; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 1.5rem; display: flex; align-items: center; gap: 1.25rem;
  box-shadow: var(--shadow-sm); backdrop-filter: blur(10px);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(94, 106, 210, 0.15); color: var(--accent-color);
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem;
}
.stat-info h3 { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; margin-bottom: 0.35rem; }
.stat-value { font-size: 2rem; font-weight: 600; color: var(--text-primary); line-height: 1; }

.chart-placeholder {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 1.5rem 2rem; backdrop-filter: blur(10px);
}
.chart-placeholder h3 { margin-bottom: 1.5rem; font-size: 1.1rem; color: var(--text-primary); font-weight: 500; }
.fake-chart { display: flex; align-items: flex-end; gap: 1rem; height: 200px; padding-top: 1rem; }
.fake-chart .bar {
  flex: 1; background: var(--border-subtle); border-radius: 4px 4px 0 0;
  transition: height 1s ease-in-out, filter 0.2s; position: relative; overflow: hidden;
}
.fake-chart .bar:hover { filter: brightness(1.2); }
.fake-chart .bar::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 100%;
  background: linear-gradient(0deg, var(--accent-color), transparent);
  opacity: 0.5; transition: opacity 0.3s;
}
.fake-chart .bar:hover::after { opacity: 0.8; }

/* Projects Tab */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.project-card-ui {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 1.5rem; transition: transform 0.2s, box-shadow 0.2s;
}
.project-card-ui:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.project-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.project-header h3 { font-size: 1.1rem; color: var(--text-primary); font-weight: 600; }
.project-header i { color: var(--text-muted); cursor: pointer; padding: 0.5rem; border-radius: 4px; transition: background 0.2s; }
.project-header i:hover { background: var(--border-subtle); color: var(--text-primary); }
.project-card-ui p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1.5rem; }
.progress-container { height: 6px; background: var(--border-subtle); border-radius: 3px; overflow: hidden; margin-bottom: 1.5rem; }
.progress-bar { height: 100%; background: var(--status-completed); border-radius: 3px; }
.project-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.due-date { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.35rem; }
.avatars { display: flex; }
.avatars img { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--bg-card); margin-left: -8px; }
.avatars img:first-child { margin-left: 0; }

/* Team Tab */
.team-header-action { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.team-member-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 1.25rem; display: flex; align-items: center; gap: 1.25rem;
  position: relative; transition: border-color 0.2s, box-shadow 0.2s;
}
.team-member-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.team-member-card img { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--border-subtle); object-fit: cover; }
.member-info h3 { font-size: 1rem; margin-bottom: 0.25rem; color: var(--text-primary); font-weight: 500; }
.member-info .role { font-size: 0.85rem; color: var(--text-secondary); }
.status { width: 12px; height: 12px; border-radius: 50%; position: absolute; top: 1.25rem; right: 1.25rem; border: 2px solid var(--bg-card); }
.status.online { background: var(--status-completed); }
.status.away { background: var(--status-in-progress); }
.status.offline { background: var(--text-muted); }

/* Avatar Upload Overlay */
.avatar-upload {
  position: relative; cursor: pointer; display: inline-block;
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--border-subtle); overflow: hidden;
}
.avatar-upload img { width: 100%; height: 100%; border: none !important; }
.upload-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); color: #fff;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s; font-size: 1.2rem;
}
.avatar-upload:hover .upload-overlay { opacity: 1; }

/* Settings Tab */
.settings-container { display: flex; flex-direction: column; gap: 1rem; max-width: 600px; }
.setting-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.5rem; background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: 12px; transition: border-color 0.2s;
}
.setting-item:hover { border-color: var(--border-strong); }
.setting-text h3 { font-size: 1.05rem; margin-bottom: 0.35rem; color: var(--text-primary); font-weight: 500;}
.setting-text p { font-size: 0.85rem; color: var(--text-muted); }

/* Toggle Switch */
.toggle-switch { position: relative; width: 44px; height: 24px; display: inline-block; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-strong); transition: .3s; border-radius: 34px;
}
.slider:before {
  position: absolute; content: ""; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background-color: var(--bg-card); transition: .3s cubic-bezier(0.175, 0.885, 0.32, 1.275); border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent-color); }
input:checked + .slider:before { transform: translateX(20px); }

/* Confetti overlay */
#confetti-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

/* 3D Glassmorphism Card Tilt rule */
.issue-card {
  /* Keep default transition for standard state changes, but it can be overridden in JS */
  transform-style: preserve-3d;
  will-change: transform;
}
.issue-card .card-top,
.issue-card .issue-title,
.issue-card .issue-tags,
.issue-card .card-bottom {
  /* Give the text a popup effect when the card tilts */
  transform: translateZ(20px);
  will-change: transform;
}
/* Smoother transition when dropping bounds */
.column-body { transition: background-color 0.3s; }
.column-body.drag-over {
  background: rgba(255, 255, 255, 0.05); /* Slight bright indication */
  outline-color: var(--accent-color); /* Highlight where it is dropped */
}

.hidden { display: none !important; }

.hidden { display: none !important; }

/* ---------------- Header UI Updates ---------------- */
.unknown-user-icon {
  width: 32px; height: 32px; border-radius: 50%; background: var(--bg-input);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 1.4rem; border: 1px solid var(--border-subtle);
  transition: all 0.2s; cursor: pointer;
}
.unknown-user-icon:hover { color: var(--accent-color); border-color: var(--accent-color); box-shadow: var(--shadow-glow); }

/* ---------------- Responsive Design ---------------- */
.mobile-only { display: none; }

@media (max-width: 1024px) {
  .search-bar.desktop-only { width: 220px; }
  .sidebar { width: 200px; }
  .board-container { padding: 1rem; }
}

@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-flex !important; }
  
  .app-layout { position: relative; }
  .sidebar {
    position: absolute; left: -240px; top: 0; bottom: 0; width: 240px;
    z-index: 1000; box-shadow: 20px 0 50px rgba(0,0,0,0.3);
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .sidebar.mobile-open { left: 0; }
  .sidebar.collapsed { width: 240px; padding: 1.25rem 1rem; } /* Override collapsed state on mobile */
  .sidebar.collapsed .sidebar-text { opacity: 1; visibility: visible; position: static; transform: none; }
  .sidebar.collapsed .sidebar-header { justify-content: space-between; padding: 0 0.5rem; }
  .sidebar-toggler { display: none; } /* Hide the Desktop toggler on mobile */

  .main-content { width: 100%; }
  .app-header { padding: 0 1rem; }
  
  .stats-grid { grid-template-columns: 1fr; }
  .board-container { gap: 1rem; padding: 1rem; }
  .column { flex: 0 0 280px; }
  
  .modal-content { padding: 1.5rem; width: 95%; margin: 10px; }
  .form-row { flex-direction: column; gap: 0; }
}

@media (max-width: 480px) {
  .page-title { font-size: 1rem; }
  .board-container { padding: 0.5rem; }
  .column { flex: 0 0 260px; }
  .login-card { padding: 2rem 1.5rem; border-radius: 0; height: 100%; max-width: none; display: flex; flex-direction: column; justify-content: center; }
}

/* ---------------- List View Table ---------------- */
.list-container {
  padding: 0 2rem 2rem 2rem;
  overflow-y: auto;
  flex: 1;
}
@media (max-width: 768px) {
  .list-container { padding: 1rem; }
  .issue-table th:nth-child(3), .issue-table td:nth-child(3),
  .issue-table th:nth-child(6), .issue-table td:nth-child(6) { display: none; } /* Hide type and assignee on mobile list */
}
.issue-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text-primary);
}
.issue-table th {
  text-align: left;
  padding: 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
}
.issue-table tr {
  transition: background 0.2s;
}
.issue-table tbody tr:hover {
  background: var(--bg-card);
}
.issue-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  vertical-align: middle;
}
.list-id { font-family: monospace; color: var(--text-muted); font-weight: 500; font-size: 0.8rem; }
.list-title { font-weight: 500; }

.status-pill {
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.pill-todo { background: rgba(139, 148, 158, 0.15); color: #8b949e; }
.pill-progress { background: rgba(241, 224, 90, 0.15); color: #f1e05a; }
.pill-resolved { background: rgba(163, 113, 247, 0.15); color: #a371f7; }
.pill-completed { background: rgba(46, 160, 67, 0.15); color: #2ea043; }

.assignee-cell { display: flex; align-items: center; gap: 0.5rem; }
.assignee-cell img { width: 24px; height: 24px; border-radius: 50%; }

/* ---------------- AI Components & Animations ---------------- */

:root {
  --ai-glow: 0 0 15px rgba(163, 113, 247, 0.4);
  --ai-linear: linear-gradient(135deg, #a371f7, #5e6ad2);
}

/* AI Sort Button */
.ai-btn {
  background: rgba(163, 113, 247, 0.1) !important;
  color: #a371f7 !important;
  border: 1px solid rgba(163, 113, 247, 0.3) !important;
  transition: all 0.3s ease;
}
.ai-btn:hover {
  background: rgba(163, 113, 247, 0.2) !important;
  box-shadow: var(--ai-glow);
  transform: translateY(-1px);
}

/* Magic Wand in Modal */
.ai-input-group {
  position: relative;
  display: flex;
  align-items: center;
}
.ai-icon-btn {
  position: absolute;
  right: 10px;
  background: var(--ai-linear);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(163, 113, 247, 0.3);
  transition: all 0.2s;
  z-index: 5;
}
.ai-icon-btn:hover {
  transform: scale(1.1) rotate(10deg);
  box-shadow: var(--ai-glow);
}
.ai-icon-btn i { font-size: 1rem; }

/* AI Assistant */
.ai-assistant-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 15px;
}

.ai-fab {
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: var(--ai-linear);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3), var(--ai-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.ai-fab:hover {
  transform: scale(1.1) rotate(15deg);
}

.ai-panel {
  width: 320px;
  background: rgba(15, 15, 19, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(163, 113, 247, 0.3);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}
.ai-panel.hidden {
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  pointer-events: none;
}

.ai-panel-header {
  padding: 1rem;
  background: rgba(163, 113, 247, 0.1);
  border-bottom: 1px solid rgba(163, 113, 247, 0.2);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #a371f7;
  font-weight: 600;
}
.ai-panel-header .icon-btn { margin-left: auto; color: var(--text-muted); }

.ai-panel-body {
  padding: 1.25rem;
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ai-bubble {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.75rem;
  border-radius: 12px 12px 12px 4px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  animation: slideUp 0.3s ease;
}

.ai-panel-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-action-btn {
  width: 100%;
  padding: 0.6rem;
  border-radius: 8px;
  background: var(--ai-linear);
  color: white;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}
.ai-action-btn:hover { opacity: 0.9; }

/* Thinking State */
.thinking {
  position: relative;
  overflow: hidden;
}
.thinking::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(163, 113, 247, 0.2), transparent);
  animation: loadingShimmer 1.5s infinite;
}

@keyframes loadingShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Thinking Pulse */
@keyframes aiPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(163, 113, 247, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(163, 113, 247, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(163, 113, 247, 0); }
}
.pulse { animation: aiPulse 2s infinite; }
