:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eef4ff;
  --text: #1f2a37;
  --muted: #667085;
  --primary: #0d6efd;
  --primary-dark: #0a58ca;
  --success: #198754;
  --danger: #dc3545;
  --border: #d9e2f0;
  --shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
  --radius: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #eef5ff 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }
.hidden, [hidden] { display: none !important; }

.app-header {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 12px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.subtitle {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 28px;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(217, 226, 240, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stats-grid article {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
}

.stat-label {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.stats-grid strong {
  font-size: 1.8rem;
}

.grid-two {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  margin-bottom: 18px;
}

.section-head h2,
.section-head h3 {
  margin: 0 0 6px;
}

.section-head p {
  margin: 0 0 16px;
  color: var(--muted);
}

.task-form,
.tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

.field.full,
.actions.full,
.tool-actions.full {
  grid-column: 1 / -1;
}

label {
  font-weight: 700;
  font-size: 0.95rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(13, 110, 253, 0.55);
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
}

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

.actions,
.tool-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn,
.icon-btn {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.btn:hover,
.icon-btn:hover { transform: translateY(-1px); }

.btn {
  padding: 12px 16px;
  font-weight: 700;
}

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

.btn-secondary {
  background: #e9eef7;
  color: var(--text);
}

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

.list-card { min-height: 330px; }

.section-head-inline {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}

.empty-state {
  border: 2px dashed var(--border);
  border-radius: 18px;
  padding: 28px 18px;
  text-align: center;
}

.empty-state img {
  width: min(260px, 100%);
  margin: 0 auto 16px;
}

.empty-state h3 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.task-list {
  display: grid;
  gap: 14px;
}

.task-item {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: #fff;
}

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

.task-title-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.task-title {
  margin: 0;
  font-size: 1.1rem;
}

.task-done .task-title {
  text-decoration: line-through;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  background: #eaf2ff;
  color: var(--primary-dark);
}

.badge-success {
  background: #e8f7ef;
  color: var(--success);
}

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

.meta span {
  background: #f5f7fb;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.86rem;
}

.task-desc {
  margin: 0;
  line-height: 1.5;
  color: #334155;
  white-space: pre-wrap;
}

.task-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.small-btn {
  padding: 10px 12px;
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid var(--border);
}

.small-btn.primary { background: #eaf2ff; color: var(--primary-dark); }
.small-btn.danger { background: #fff1f2; color: #b42318; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 1000;
}

.modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  padding: 20px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.modal-head h2 { margin: 0; }

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #eef2f7;
  font-size: 1.6rem;
  line-height: 1;
}

body.modal-open { overflow: hidden; }

@media (max-width: 900px) {
  .stats-grid,
  .grid-two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-header { flex-direction: column; }
  .task-form,
  .tools { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .task-top { flex-direction: column; }
}
