:root {
  --bg: #0f1622;
  --card: rgba(255, 255, 255, 0.08);
  --card-strong: rgba(255, 255, 255, 0.12);
  --text: #e8edf5;
  --muted: #9fb0c6;
  --accent: #5de2a7;
  --accent-2: #7ecbff;
  --danger: #ff7b7b;
  --warning: #f5c06b;
  --success: #7ae27a;
  --shadow: 0 15px 50px rgba(0, 0, 0, 0.35);
  --border: 1px solid rgba(255, 255, 255, 0.08);
  --radius: 14px;
  --pill: rgba(255, 255, 255, 0.12);
}

body.light {
  --bg: #f3f6fb;
  --card: #ffffff;
  --card-strong: #f0f4ff;
  --text: #0f172a;
  --muted: #667488;
  --accent: #1fd1a3;
  --accent-2: #2470ff;
  --danger: #ff6464;
  --warning: #e0a100;
  --success: #23c36b;
  --shadow: 0 15px 50px rgba(33, 46, 62, 0.12);
  --border: 1px solid rgba(15, 23, 42, 0.08);
  --pill: rgba(36, 112, 255, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(36, 112, 255, 0.2), transparent 35%),
              radial-gradient(circle at 80% 10%, rgba(31, 209, 163, 0.2), transparent 30%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.4s ease, color 0.2s ease;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px rgba(36, 112, 255, 0.3);
}

.brand-name { font-weight: 700; letter-spacing: 0.2px; }
.brand-sub { display: block; color: var(--muted); font-size: 12px; }

.top-actions { display: flex; gap: 10px; align-items: center; }

button {
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  border-radius: 12px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}

button:active { transform: translateY(1px); }

button.primary {
  padding: 12px 18px;
  color: #0f172a;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px rgba(36, 112, 255, 0.25);
}

button.ghost {
  padding: 10px 14px;
  background: var(--card);
  color: var(--text);
  border: var(--border);
}

button.icon {
  width: 34px;
  height: 34px;
  background: var(--card);
  border: var(--border);
  color: var(--text);
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: var(--border);
  box-shadow: var(--shadow);
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-card p { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.stat-card h3 { margin: 0; font-size: 26px; }
.stat-card.alert { outline: 2px solid var(--danger); }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  align-items: flex-end;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.filters { display: flex; gap: 12px; flex-wrap: wrap; }

label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }

input, select, textarea {
  background: var(--card-strong);
  border: var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border 0.2s ease;
}

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

.controls .search input { min-width: 220px; }
.sort { display: flex; align-items: flex-end; }

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.column {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 260px;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 14px 6px;
}

.column-body { padding: 8px 12px 14px; display: flex; flex-direction: column; gap: 10px; }

.pill {
  background: var(--pill);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 600;
  font-size: 12px;
}

.task-card {
  background: var(--card-strong);
  border: var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  position: relative;
}

.task-card.overdue { border-color: var(--danger); box-shadow: 0 10px 24px rgba(255, 100, 100, 0.25); }

.task-header { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }

.title-group { display: flex; gap: 8px; align-items: center; }

.task-card h5 { margin: 0; font-size: 16px; }

.priority {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
}

.priority.high { background: linear-gradient(135deg, var(--danger), #ff9a9a); }
.priority.medium { background: linear-gradient(135deg, var(--warning), #ffd78f); }
.priority.low { background: linear-gradient(135deg, var(--success), #9df2b5); }

.card-actions { display: flex; gap: 6px; }

.description { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4; }

.meta { display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--card);
  border: var(--border);
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
}

.badge.status.todo { color: var(--warning); }
.badge.status.in_progress { color: var(--accent-2); }
.badge.status.done { color: var(--success); }

.badge.deadline.overdue { color: var(--danger); }

.footer { display: flex; gap: 6px; flex-wrap: wrap; }
.footer .ghost { padding: 8px 10px; font-size: 12px; }

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal.open { display: flex; }

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

.modal-content {
  position: relative;
  z-index: 1;
  background: var(--card);
  border: var(--border);
  border-radius: 16px;
  padding: 18px;
  width: min(520px, 92vw);
  box-shadow: var(--shadow);
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-header h3 { margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }

textarea { resize: vertical; min-height: 72px; }

.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 8px; }

.empty-state {
  text-align: center;
  padding: 18px;
  border: var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--card-strong);
}

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .controls { flex-direction: column; align-items: stretch; }
  .sort { width: 100%; }
  .sort select, .controls .search input { width: 100%; }
  .footer { flex-direction: column; }
  button { width: auto; }
}

@media (max-width: 420px) {
  .top-actions { width: 100%; justify-content: space-between; }
}

.task-card[draggable="true"] {
  cursor: grab;
}

.task-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
  transform: scale(0.98);
}

.column {
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.column.drag-over {
  background: var(--card-strong);
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(31, 209, 163, 0.1);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: var(--card);
  color: var(--text);
  border: var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: none;
  gap: 12px;
  align-items: center;
  z-index: 30;
}

.toast.show { display: flex; }
.toast__message { font-weight: 600; }
.toast__actions { display: flex; gap: 8px; }
