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

:root {
  --bg:          #0f172a;
  --surface:     #1e293b;
  --surface-alt: #253349;
  --border:      #334155;
  --text:        #f1f5f9;
  --text-muted:  #94a3b8;
  --accent:      #6366f1;
  --accent-hover:#4f46e5;
  --danger:      #ef4444;
  --success:     #22c55e;
  --warning:     #f59e0b;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 4px 24px rgba(0,0,0,.4);
  --transition:  .2s ease;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Header ───────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  font-size: 28px;
  color: var(--accent);
  line-height: 1;
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.subtitle {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:hover { background: var(--border); }

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

.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

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

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 5px 10px; font-size: .8rem; }

.btn-icon {
  padding: 6px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-icon:hover { background: var(--surface-alt); color: var(--text); }

/* ── Layout ───────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 32px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 80px);
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
}

/* ── Panel ────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-head h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Project Cards ────────────────────────────────────────────── */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.project-list::-webkit-scrollbar { width: 6px; }
.project-list::-webkit-scrollbar-track { background: transparent; }
.project-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.project-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.project-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.project-card.active { border-color: var(--accent); background: rgba(99,102,241,.1); }

.project-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.project-card-title {
  font-weight: 600;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.project-card-desc {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.project-card:hover .project-card-actions { opacity: 1; }

.project-card .btn-icon { padding: 4px; }

/* ── Progress Bar ─────────────────────────────────────────────── */
.progress-overview {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.progress-overview h3 {
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.progress-bar {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  border-radius: 999px;
  transition: width .4s ease;
  width: 0%;
}

.progress-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
}

/* ── Task List ────────────────────────────────────────────────── */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.task-list::-webkit-scrollbar { width: 6px; }
.task-list::-webkit-scrollbar-track { background: transparent; }
.task-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.task-item:hover { border-color: var(--accent); }

.task-item.completed { opacity: .5; }
.task-item.completed .task-text { text-decoration: line-through; }

.task-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.task-checkbox:hover { border-color: var(--accent); }

.task-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.task-checkbox.checked::after {
  content: "\2713";
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.task-content { flex: 1; min-width: 0; }

.task-text {
  font-size: .9rem;
  word-break: break-word;
}

.task-meta {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.task-tag {
  font-size: .7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-muted);
}

.task-tag.overdue { background: rgba(239,68,68,.2); color: var(--danger); }

.task-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.task-item:hover .task-actions { opacity: 1; }

/* ── Notes ────────────────────────────────────────────────────── */
.notes-section {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.notes-area {
  width: 100%;
  min-height: 140px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  resize: vertical;
  transition: border-color var(--transition);
}

.notes-area:focus { outline: none; border-color: var(--accent); }

.notes-meta {
  font-size: .75rem;
  color: var(--text-muted);
  text-align: right;
}

/* ── Modal ────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field span {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field input,
.field textarea,
.field select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  font-size: .9rem;
  font-family: inherit;
  transition: border-color var(--transition);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
}

.field textarea { resize: vertical; }

.field select { cursor: pointer; }

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

/* ── Empty State ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 10px;
  opacity: .5;
}

.empty-state p {
  font-size: .85rem;
}

/* ── Toast ────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: .85rem;
  box-shadow: var(--shadow);
  animation: toastIn .3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .app-header { padding: 16px; }
  .layout { padding: 12px; gap: 16px; }
  .header-actions .btn span { display: none; }
  .project-card-actions,
  .task-actions { opacity: 1; }
}
