/* ============================================================
   Antigravity Kanban Board — Design System
   Version: 0.2.0
   
   Derived from Stitch UI designs + reference screenshots.
   "Pragmatic Physicality" aesthetic: clean, elevated, premium.
   ============================================================ */

/* ---- CSS Custom Properties ---- */
:root {
  /* Primary palette */
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-primary-light: #e0e7ff;
  --color-primary-dark: #3730a3;

  /* Neutral grays */
  --color-bg: #f8f9fb;
  --color-surface: #ffffff;
  --color-surface-hover: #f1f3f9;
  --color-border: #e5e7eb;
  --color-border-light: #f0f0f0;
  --color-text-primary: #111827;
  --color-text-secondary: #6b7280;
  --color-text-muted: #9ca3af;

  /* Sidebar */
  --color-sidebar: #1e1b3a;
  --color-sidebar-hover: #2d2a52;
  --color-sidebar-text: #a5a3c4;
  --color-sidebar-active: #ffffff;

  /* Semantic / category colors */
  --color-category-purple: #8b5cf6;
  --color-category-blue: #3b82f6;
  --color-category-green: #22c55e;
  --color-category-orange: #f97316;
  --color-category-teal: #14b8a6;
  --color-category-red: #ef4444;
  --color-category-pink: #ec4899;

  /* Priority colors */
  --color-priority-low: #22c55e;
  --color-priority-medium: #f59e0b;
  --color-priority-high: #f97316;
  --color-priority-critical: #ef4444;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-drag: 0 12px 28px rgba(99, 102, 241, 0.15), 0 4px 10px rgba(0, 0, 0, 0.08);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.8125rem;
  --font-size-base: 0.875rem;
  --font-size-lg: 1rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ---- Dark Mode ---- */
[data-theme="dark"] {
  --color-bg: #0f0d1a;
  --color-surface: #1a1730;
  --color-surface-hover: #252240;
  --color-border: #2d2a52;
  --color-border-light: #1f1c3a;
  --color-text-primary: #f1f0f7;
  --color-text-secondary: #a5a3c4;
  --color-text-muted: #6b6890;
  --color-sidebar: #0a0818;
  --color-sidebar-hover: #151230;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.35);
  --shadow-drag: 0 12px 28px rgba(99, 102, 241, 0.2), 0 4px 10px rgba(0, 0, 0, 0.3);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

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

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

/* ---- Sidebar ---- */
.sidebar {
  width: 72px;
  background: var(--color-sidebar);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4) 0;
  transition: width var(--transition-slow);
  z-index: 100;
  flex-shrink: 0;
}

.sidebar.expanded {
  width: 240px;
  align-items: flex-start;
  padding: var(--space-4) var(--space-4);
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--color-primary), #a855f7);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-8);
  font-weight: 700;
  color: white;
  font-size: var(--font-size-lg);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-sidebar-text);
  transition: all var(--transition-fast);
  text-decoration: none;
  justify-content: center;
  white-space: nowrap;
}

.sidebar.expanded .sidebar-link {
  justify-content: flex-start;
}

.sidebar-link:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-sidebar-active);
}

.sidebar-link.active {
  background: var(--color-sidebar-hover);
  color: var(--color-sidebar-active);
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-link-text {
  display: none;
}

.sidebar.expanded .sidebar-link-text {
  display: inline;
}

.sidebar-bottom {
  margin-top: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  justify-content: center;
}

.sidebar.expanded .sidebar-user {
  justify-content: flex-start;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Top Bar ---- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.page-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
}

.view-tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--color-bg);
  padding: var(--space-1);
  border-radius: var(--radius-md);
}

.view-tab {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.view-tab:hover {
  color: var(--color-text-primary);
  background: var(--color-surface);
}

.view-tab.active {
  color: var(--color-text-primary);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.btn-ghost {
  color: var(--color-text-secondary);
  padding: var(--space-2);
}

.btn-ghost:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

/* ---- Board Layout ---- */
.board-container {
  flex: 1;
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  overflow-x: auto;
  overflow-y: hidden;
}

/* ---- Columns ---- */
.column {
  min-width: 300px;
  max-width: 340px;
  width: 300px;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  max-height: calc(100vh - 140px);
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  flex-shrink: 0;
}

.column-title {
  font-weight: 600;
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.column-count {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.column-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.column-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-3) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Scrollbar styling */
.column-body::-webkit-scrollbar {
  width: 4px;
}

.column-body::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

/* Column highlight on drag over */
.column.drag-over {
  background: var(--color-primary-light);
  border: 2px dashed var(--color-primary);
}

/* Empty column state */
.column-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  color: var(--color-text-muted);
  text-align: center;
  gap: var(--space-3);
}

.column-empty svg {
  width: 48px;
  height: 48px;
  opacity: 0.3;
}

/* ---- Task Cards ---- */
.task-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
  border: 1px solid transparent;
}

.task-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border);
}

.task-card:active {
  cursor: grabbing;
}

/* Drag states */
.task-card.dragging {
  box-shadow: var(--shadow-drag);
  transform: rotate(2deg) scale(1.02);
  opacity: 0.9;
  z-index: 1000;
}

.task-card.ghost {
  opacity: 0.3;
  border: 2px dashed var(--color-primary);
  background: var(--color-primary-light);
}

.sortable-ghost {
  opacity: 0.3;
  border: 2px dashed var(--color-primary) !important;
  background: var(--color-primary-light) !important;
}

.sortable-drag {
  box-shadow: var(--shadow-drag) !important;
  transform: rotate(2deg) scale(1.02) !important;
}

/* Card content */
.card-category {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.card-title {
  font-weight: 600;
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
  line-height: 1.4;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  margin-bottom: var(--space-3);
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.card-meta-item svg {
  width: 14px;
  height: 14px;
}

.time-logged {
  color: var(--color-category-red);
  font-weight: 500;
}

/* Subtask progress bar */
.subtask-progress {
  margin-bottom: var(--space-3);
}

.subtask-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), #a855f7);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

/* Card footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-avatars {
  display: flex;
}

.card-avatars .user-avatar {
  width: 28px;
  height: 28px;
  font-size: var(--font-size-xs);
  border: 2px solid var(--color-surface);
  margin-left: -8px;
}

.card-avatars .user-avatar:first-child {
  margin-left: 0;
}

.card-stats {
  display: flex;
  gap: var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
}

.card-stats span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.card-stats svg {
  width: 14px;
  height: 14px;
}

/* ---- Task Detail Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  display: flex;
  transform: translateY(20px);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-main {
  flex: 1;
  padding: var(--space-8);
  overflow-y: auto;
}

.modal-sidebar {
  width: 280px;
  padding: var(--space-8);
  border-left: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
}

.modal-close:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

/* ---- Chatbot Panel ---- */
.chatbot-panel {
  position: fixed;
  right: -400px;
  top: 0;
  width: 380px;
  height: 100vh;
  background: var(--color-surface);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
  z-index: 500;
  display: flex;
  flex-direction: column;
  transition: right var(--transition-slow);
}

.chatbot-panel.open {
  right: 0;
}

.chatbot-header {
  background: linear-gradient(135deg, var(--color-primary), #a855f7);
  padding: var(--space-4) var(--space-5);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chatbot-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.chatbot-provider {
  font-size: var(--font-size-xs);
  opacity: 0.8;
  padding: var(--space-1) var(--space-4);
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.chat-message {
  max-width: 85%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.chat-message.ai {
  background: var(--color-bg);
  color: var(--color-text-primary);
  align-self: flex-start;
  border-bottom-left-radius: var(--radius-sm);
}

.chat-message.user {
  background: var(--color-primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: var(--radius-sm);
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-2);
}

.chat-suggestion-chip {
  padding: var(--space-2) var(--space-3);
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.chat-suggestion-chip:hover {
  background: var(--color-primary);
  color: white;
}

.chatbot-input {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.chatbot-input input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-bg);
  color: var(--color-text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}

.chatbot-input input:focus {
  border-color: var(--color-primary);
}

.chatbot-input .btn-send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-input .btn-send:hover {
  background: var(--color-primary-hover);
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-weight: 500;
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ---- Login Page ---- */
.login-page {
  display: flex;
  min-height: 100vh;
}

.login-brand {
  flex: 3;
  background: linear-gradient(135deg, #1e1b3a 0%, #0f0d1a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15), transparent);
  border-radius: 50%;
  top: 20%;
  left: 30%;
}

.login-brand h1 {
  font-size: var(--font-size-3xl);
  color: white;
  font-weight: 700;
  margin-bottom: var(--space-3);
  z-index: 1;
}

.login-brand p {
  color: var(--color-sidebar-text);
  font-size: var(--font-size-lg);
  max-width: 400px;
  text-align: center;
  z-index: 1;
}

.login-form-container {
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
  background: var(--color-surface);
}

.login-form {
  width: 100%;
  max-width: 400px;
}

.login-form h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin-bottom: var(--space-8);
}

.login-tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-6);
  background: var(--color-bg);
  padding: var(--space-1);
  border-radius: var(--radius-md);
}

.login-tab {
  flex: 1;
  padding: var(--space-3);
  text-align: center;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.login-tab.active {
  background: var(--color-surface);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-sm);
}

/* ---- Settings Page ---- */
.settings-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.settings-nav {
  width: 220px;
  padding: var(--space-6);
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

.settings-nav-item {
  display: block;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-weight: 500;
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
  margin-bottom: var(--space-1);
}

.settings-nav-item:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.settings-nav-item.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.settings-content {
  flex: 1;
  padding: var(--space-6) var(--space-8);
  overflow-y: auto;
}

.settings-section {
  margin-bottom: var(--space-8);
}

.settings-section h3 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

/* ---- Projects Dashboard ---- */
.projects-container {
  flex: 1;
  display: flex;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-6);
  overflow-x: auto;
}

.projects-main {
  flex: 1;
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
}

.project-column {
  min-width: 280px;
  flex: 1;
}

.project-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  font-size: var(--font-size-xs);
  letter-spacing: 0.05em;
}

.project-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
}

.project-card:hover {
  box-shadow: var(--shadow-md);
}

/* Right stats panel */
.stats-panel {
  width: 300px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  height: fit-content;
  position: sticky;
  top: var(--space-4);
}

.donut-chart {
  width: 160px;
  height: 160px;
  margin: 0 auto var(--space-6);
  position: relative;
}

.donut-chart svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-chart .percentage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.stat-card {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-card .stat-label {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.stat-card .stat-value {
  font-size: var(--font-size-xl);
  font-weight: 700;
}

/* ---- Toggle Switch ---- */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: transform var(--transition-fast);
}

.toggle input:checked+.toggle-slider {
  background: var(--color-primary);
}

.toggle input:checked+.toggle-slider::before {
  transform: translateX(20px);
}

/* ---- Utilities ---- */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: var(--space-1);
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.text-sm {
  font-size: var(--font-size-sm);
}

.text-xs {
  font-size: var(--font-size-xs);
}

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

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.hidden {
  display: none !important;
}

/* ---- Accessibility ---- */

/* Screen reader only — visually hidden but announced */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Show sr-only element on focus (skip-to-content) */
.focus-visible-show:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 9999;
  width: auto;
  height: auto;
  padding: var(--space-2) var(--space-4);
  margin: 0;
  clip: auto;
  overflow: visible;
  white-space: normal;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-decoration: none;
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Keyboard focus ring for all interactive elements */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ---- Dark Mode: OS-level fallback ---- */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --color-bg: #111113;
    --color-surface: #1a1a1e;
    --color-surface-raised: #222226;
    --color-border: #2a2a2e;
    --color-text: #f0f0f2;
    --color-text-secondary: #a0a0a8;
    --color-text-muted: #68686f;
  }
}

/* ---- Responsive ---- */

/* Tablet: sidebar collapses, columns scroll */
@media (max-width: 1024px) {
  .sidebar {
    width: 56px;
  }

  .sidebar-link-text {
    display: none;
  }

  .stats-panel {
    display: none;
  }

  .column {
    min-width: 260px;
  }
}

/* Mobile-landscape / small tablet */
@media (max-width: 768px) {

  /* Sidebar → bottom tab bar */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: 56px;
    flex-direction: row;
    z-index: 300;
    border-top: 1px solid var(--color-border);
    border-right: none;
    padding: 0;
  }

  .sidebar-logo {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    gap: 0;
    padding: 0;
  }

  .sidebar-link {
    flex-direction: column;
    font-size: 10px;
    padding: var(--space-1);
  }

  .sidebar-link svg {
    width: 20px;
    height: 20px;
  }

  .sidebar-link-text {
    display: block;
    font-size: 10px;
  }

  .sidebar-bottom {
    display: none;
  }

  /* Main content: add bottom padding for tab bar */
  .main-content {
    margin-left: 0;
    padding-bottom: 72px;
  }

  .top-bar {
    padding: var(--space-3);
    gap: var(--space-2);
    flex-wrap: wrap;
  }

  /* Board: horizontal scroll, single column visible */
  .board-container {
    padding: var(--space-3);
  }

  .board-columns {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .column {
    min-width: 85vw;
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  /* Full-width modal */
  .modal {
    width: 95vw;
    max-width: none;
    max-height: 90vh;
    flex-direction: column;
  }

  .modal-sidebar {
    border-left: none;
    border-top: 1px solid var(--color-border);
  }

  /* Full-width chatbot */
  .chatbot-panel {
    width: 100%;
    max-width: 100%;
  }

  /* Login: single-column */
  .login-brand {
    display: none;
  }

  .login-form-container {
    padding: var(--space-6);
  }

  /* Settings: single column */
  .settings-content {
    flex-direction: column;
  }

  .settings-sidebar {
    flex-direction: row;
    overflow-x: auto;
  }
}

/* Mobile-portrait */
@media (max-width: 480px) {
  .top-bar h1 {
    font-size: var(--font-size-lg);
  }

  .view-tabs {
    gap: var(--space-1);
  }

  .view-tab {
    padding: var(--space-1) var(--space-2);
    font-size: var(--font-size-xs);
  }

  .column {
    min-width: 92vw;
  }

  /* Stack project cards */
  .projects-grid {
    grid-template-columns: 1fr;
  }

  /* Calendar: smaller cells */
  .calendar-grid {
    font-size: var(--font-size-xs);
  }

  /* Chat suggestion chips: scroll */
  .chat-suggestions {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
}

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