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

:root {
  --bg: #0d0d0d;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #242424;
  --border: #333;
  --text: #e0e0e0;
  --text-muted: #888;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-bg: rgba(99, 102, 241, 0.15);
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 1rem; border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  font-size: 0.875rem; font-weight: 500;
  background: var(--bg-tertiary); color: var(--text);
  transition: all 0.15s ease;
}
.btn:hover { background: var(--border); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: transparent; border-color: var(--border); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 0.25rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* === Forms === */
input, textarea, select {
  width: 100%; padding: 0.625rem 0.75rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 0.875rem; font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); }
label { display: block; margin-bottom: 0.25rem; font-size: 0.8rem; color: var(--text-muted); }

/* === Alerts === */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.875rem; }
.alert-error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: var(--danger); }

/* === Landing === */
.landing { display: flex; flex-direction: column; }
.landing-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 2rem; border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.logo { font-size: 1.25rem; font-weight: 700; color: var(--text) !important; }
.nav-actions { display: flex; gap: 0.75rem; }

.hero {
  text-align: center; padding: 6rem 2rem 4rem;
  max-width: 900px; margin: 0 auto;
}
.hero h1 { font-size: 3rem; font-weight: 800; line-height: 1.2; margin-bottom: 1.5rem; }
.hero .highlight { color: var(--primary); }
.hero-sub { font-size: 1.2rem; color: var(--text-muted); max-width: 650px; margin: 0 auto 2rem; }
.hero-cta { display: flex; gap: 1rem; justify-content: center; }

.features { padding: 4rem 2rem; max-width: 1100px; margin: 0 auto; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.feature-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  transition: border-color 0.2s;
}
.feature-card:hover { border-color: var(--primary); }
.feature-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-muted); font-size: 0.9rem; }

.landing-footer { text-align: center; padding: 2rem; color: var(--text-muted); border-top: 1px solid var(--border); }

/* === Auth Pages === */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-container { width: 100%; max-width: 420px; padding: 1rem; }
.auth-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; }
.auth-header { text-align: center; margin-bottom: 1.5rem; }
.auth-header h2 { margin-top: 0.75rem; font-size: 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 0.75rem; }
.auth-form label { margin-bottom: -0.5rem; }
.auth-footer { text-align: center; margin-top: 1.25rem; font-size: 0.875rem; color: var(--text-muted); }
.divider { display: flex; align-items: center; margin: 1.25rem 0; color: var(--text-muted); font-size: 0.8rem; }
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border); }
.divider span { padding: 0 0.75rem; }

/* === App Shell === */
.app-shell { overflow: hidden; }
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px; min-width: 260px; background: var(--bg-secondary);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 1rem;
}
.sidebar-header { margin-bottom: 1rem; }
.sidebar-org { margin-bottom: 1rem; }
.org-name { font-size: 0.875rem; color: var(--text-muted); }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.nav-item {
  display: block; padding: 0.5rem 0.75rem; border-radius: var(--radius);
  font-size: 0.875rem; color: var(--text-muted); background: none; border: none;
  width: 100%; text-align: left; cursor: pointer; transition: all 0.15s;
}
.nav-item:hover, .nav-item.active { background: var(--bg-tertiary); color: var(--text); }
.sidebar-section { margin-top: 1.5rem; }
.sidebar-section h4 { font-size: 0.7rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem; padding: 0 0.75rem; }
.sidebar-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.user-info { font-size: 0.8rem; color: var(--text-muted); }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-header { padding: 1rem 2rem; border-bottom: 1px solid var(--border); background: var(--bg-secondary); }
.app-header h1 { font-size: 1.25rem; }
.app-content { padding: 2rem; flex: 1; }

/* === Projects Grid === */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.project-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  cursor: pointer; transition: border-color 0.15s;
}
.project-card:hover { border-color: var(--primary); }
.project-card h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.project-card p { color: var(--text-muted); font-size: 0.825rem; }
.project-emoji { font-size: 1.5rem; margin-bottom: 0.5rem; }

/* === Inline Forms === */
.inline-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.inline-form input { max-width: 250px; }

/* === Responsive === */
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero-sub { font-size: 1rem; }
  .hero-cta { flex-direction: column; align-items: center; }
  .sidebar { width: 200px; min-width: 200px; }
  .feature-grid { grid-template-columns: 1fr; }
  .kanban-board { overflow-x: auto; }
}

/* === Kanban Board === */
.kanban-board {
  display: flex; gap: 1rem; padding: 1.5rem 2rem;
  overflow-x: auto; min-height: calc(100vh - 200px);
  align-items: flex-start;
}
.kanban-column {
  min-width: 280px; max-width: 320px; flex: 1;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column;
}
.kanban-column-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 0.9rem;
}
.column-count {
  background: var(--bg-tertiary); border-radius: 12px;
  padding: 0.1rem 0.5rem; font-size: 0.75rem; color: var(--text-muted);
}
.kanban-tasks {
  flex: 1; padding: 0.5rem; min-height: 60px;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.kanban-add-btn {
  margin: 0.5rem; padding: 0.5rem; text-align: center;
  color: var(--text-muted); font-size: 0.8rem; border: 1px dashed transparent;
}
.kanban-add-btn:hover { border-color: var(--border); color: var(--text); }

/* Task Card */
.task-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem;
  cursor: grab; transition: all 0.15s;
}
.task-card:hover { border-color: var(--primary); }
.task-card.dragging { opacity: 0.5; transform: rotate(2deg); }
.task-card-header { display: flex; align-items: flex-start; gap: 0.5rem; }
.task-title { font-size: 0.875rem; line-height: 1.3; word-break: break-word; }
.task-priority { width: 8px; height: 8px; border-radius: 50%; margin-top: 0.35rem; flex-shrink: 0; }
.priority-urgent { background: var(--danger); }
.priority-high { background: #f97316; }
.priority-medium { background: var(--warning); }
.priority-low { background: var(--success); }
.priority-none { background: var(--border); }

.task-assignee { margin-top: 0.5rem; font-size: 0.75rem; color: var(--text-muted); }
.task-skeleton { color: var(--text-muted); font-size: 0.8rem; padding: 0.5rem; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; display: none;
}
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto; padding: 1.5rem;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 0.5rem;
  margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border);
}

#task-form { display: flex; flex-direction: column; gap: 0.75rem; }
.form-row { display: flex; gap: 1rem; }
.form-row > div { flex: 1; }
