* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --text: #172033;
  --muted: #7a8499;
  --border: #e8ebf2;
  --primary: #6256e8;
  --primary-dark: #5145d1;
  --green: #20a66a;
  --red: #e45757;
  --orange: #e99b32;
  --shadow: 0 12px 35px rgba(31, 41, 65, .07);
}

body {
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: 0; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(98, 86, 232, .2);
  outline-offset: 2px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
}

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

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 21px;
  font-weight: 800;
  background: var(--primary);
  box-shadow: 0 8px 20px rgba(98, 86, 232, .25);
}

.brand h1 { font-size: 19px; letter-spacing: -.4px; }
.brand span { font-size: 11px; color: var(--muted); }

.nav { display: grid; gap: 7px; }

.nav-item {
  width: 100%;
  padding: 12px 13px;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: .2s;
}

.nav-item span { width: 18px; text-align: center; font-weight: 700; }
.nav-item b { margin-left: auto; font-size: 12px; font-weight: 600; }

.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: #f0efff; color: var(--primary); font-weight: 700; }

.sidebar-bottom { margin-top: auto; }
.tip {
  background: #f7f6ff;
  border: 1px solid #e9e7ff;
  border-radius: 14px;
  padding: 15px;
  margin: 20px 4px;
}
.tip strong { font-size: 12px; }
.tip p { color: var(--muted); font-size: 11px; line-height: 1.6; margin-top: 5px; }
.text-button {
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  margin-left: 12px;
}
.text-button:hover { color: var(--red); }

.main {
  flex: 1;
  max-width: 1500px;
  margin: 0 auto;
  padding: 38px 42px 60px;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
}
.eyebrow {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.4px;
  margin-bottom: 7px;
}
.topbar h2 { font-size: 28px; letter-spacing: -.8px; }
.subheading { color: var(--muted); font-size: 13px; margin-top: 5px; }

.primary-btn, .secondary-btn {
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 700;
  font-size: 13px;
  transition: .2s;
}
.primary-btn { background: var(--primary); color: white; box-shadow: 0 7px 18px rgba(98, 86, 232, .2); }
.primary-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.secondary-btn { background: #f0f1f5; color: var(--text); }
.secondary-btn:hover { background: #e7e8ee; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 17px;
  display: flex;
  align-items: center;
  gap: 13px;
  box-shadow: 0 5px 20px rgba(31, 41, 65, .03);
}
.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
}
.stat-icon.total { background: #eeecff; color: var(--primary); }
.stat-icon.active-stat { background: #fff5df; color: var(--orange); }
.stat-icon.done { background: #e7f8ef; color: var(--green); }
.stat-icon.urgent { background: #ffebeb; color: var(--red); }
.stat-card span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.stat-card strong { font-size: 21px; }

.workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.toolbar {
  padding: 17px 19px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
}
.filters { display: flex; gap: 5px; }
.filter-btn {
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 600;
}
.filter-btn:hover { background: var(--surface-2); }
.filter-btn.active { background: #efeeff; color: var(--primary); }

.search {
  margin-left: auto;
  width: 240px;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
}
.search input { border: 0; outline: 0; width: 100%; background: transparent; font-size: 12px; color: var(--text); }
.toolbar select {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
  padding: 8px 9px;
  color: var(--muted);
  font-size: 11px;
}

.task-list { padding: 4px 19px 10px; }

.task {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  padding: 17px 2px;
  align-items: start;
  border-bottom: 1px solid var(--border);
  transition: .2s;
}
.task:last-child { border-bottom: 0; }
.task:hover { background: #fcfcfe; }
.check {
  width: 21px;
  height: 21px;
  border: 2px solid #cfd4df;
  border-radius: 7px;
  background: white;
  color: white;
  display: grid;
  place-items: center;
  font-size: 12px;
  margin-top: 1px;
}
.task.completed .check { background: var(--green); border-color: var(--green); }
.task-body h4 { font-size: 13px; line-height: 1.35; margin-bottom: 5px; }
.task.completed h4 { text-decoration: line-through; color: #9aa2b2; }
.task-body p { color: var(--muted); font-size: 11px; line-height: 1.5; max-width: 650px; }
.task-meta { display: flex; align-items: center; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.badge {
  font-size: 9px;
  font-weight: 800;
  padding: 4px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge.low { background: #edf7f1; color: #25845a; }
.badge.medium { background: #fff6e5; color: #b27718; }
.badge.high { background: #ffeded; color: #c94343; }
.due { font-size: 10px; color: var(--muted); }
.due.overdue { color: var(--red); font-weight: 700; }
.task-actions { display: flex; gap: 4px; opacity: 0; transition: .2s; }
.task:hover .task-actions, .task:focus-within .task-actions { opacity: 1; }
.icon-button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
}
.icon-button:hover { background: #f1f2f6; color: var(--text); }
.icon-button.delete:hover { background: #ffeded; color: var(--red); }

.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon {
  width: 50px; height: 50px; border-radius: 15px;
  display: grid; place-items: center; margin: 0 auto 15px;
  background: #e8f8ef; color: var(--green); font-size: 20px; font-weight: 800;
}
.empty-state h3 { font-size: 15px; margin-bottom: 6px; }
.empty-state p { color: var(--muted); font-size: 12px; margin-bottom: 17px; }
.hidden { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(19, 25, 40, .48); backdrop-filter: blur(3px); }
.modal-card {
  position: relative;
  width: min(520px, 100%);
  background: white;
  border-radius: 17px;
  padding: 23px;
  box-shadow: 0 25px 80px rgba(19, 25, 40, .22);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; margin-bottom: 22px; }
.modal-header h3 { font-size: 19px; }
.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field > span { font-size: 11px; font-weight: 700; color: #596276; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 11px;
  color: var(--text);
  background: white;
  font-size: 12px;
}
.field textarea { resize: vertical; min-height: 90px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

@media (max-width: 900px) {
  .sidebar { width: 215px; }
  .main { padding: 28px 22px 45px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .toolbar { flex-wrap: wrap; }
  .search { margin-left: 0; flex: 1; }
}
@media (max-width: 650px) {
  .app-shell { display: block; }
  .sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--border); padding: 15px; }
  .brand { padding: 0 5px 14px; }
  .nav { display: flex; overflow-x: auto; }
  .nav-item { min-width: 115px; }
  .sidebar-bottom { display: none; }
  .main { padding: 22px 14px 35px; }
  .topbar { align-items: flex-start; gap: 15px; }
  .topbar h2 { font-size: 23px; }
  .stats { gap: 9px; }
  .stat-card { padding: 12px; }
  .stat-icon { width: 34px; height: 34px; }
  .stat-card strong { font-size: 18px; }
  .toolbar { padding: 12px; }
  .search { width: 100%; flex-basis: 100%; }
  .toolbar select { flex: 1; }
  .task { grid-template-columns: 24px 1fr; }
  .task-actions { grid-column: 2; opacity: 1; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
}
