* {
  box-sizing: border-box;
}

:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --primary: #3b82f6;
  --primary-dark: #2456b8;
  --text: #172033;
  --muted: #68758d;
  --border: #dfe8f6;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: rgba(15, 23, 42, 0.08);
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(135deg, #eef5ff, #f9fbff);
  color: var(--text);
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

.topbar {
  background: #111827;
  color: white;
  box-shadow: 0 10px 25px var(--shadow);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.brand {
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 0.04em;
}

nav {
  display: flex;
  gap: 1.5rem;
}

nav a {
  color: white;
  text-decoration: none;
  font-weight: 600;
}

main {
  padding: 2.5rem 0 4rem;
}

.page-header,
.form-shell {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem 1.8rem;
  box-shadow: 0 20px 35px var(--shadow);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

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

h1,
h2,
h3 {
  margin: 0;
}

.button {
  border: none;
  border-radius: 10px;
  padding: 0.85rem 1.2rem;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s ease;
}

.button.primary {
  background: var(--primary);
  color: white;
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.secondary {
  background: #eef2ff;
  color: var(--text);
}

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

.stat-card {
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 12px 22px var(--shadow);
  border: 1px solid var(--border);
  padding: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-card strong {
  font-size: 2rem;
}

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

.card {
  background: var(--panel);
  padding: 1.3rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 15px 30px var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.card p {
  color: var(--muted);
  line-height: 1.6;
  min-height: 70px;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 1rem;
}

.tag {
  display: inline-block;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
}

.tag.open {
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary);
}

.tag.in-progress {
  background: rgba(245, 158, 11, 0.12);
  color: #a16207;
}

.tag.completed {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.delete-btn {
  border: none;
  background: rgba(239, 68, 68, 0.09);
  color: var(--danger);
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.empty-state {
  padding: 2rem;
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  text-align: center;
}

.project-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 1rem;
}

.project-form label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 0.95rem;
  font-size: 1rem;
  background: white;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(59, 130, 246, 0.18);
  border-color: var(--primary);
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.flash-wrap {
  margin-bottom: 1rem;
}

.flash {
  background: #e0f2fe;
  color: #075985;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid #bae6fd;
  margin-bottom: 0.75rem;
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

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

  nav {
    gap: 0.8rem;
    font-size: 0.9rem;
  }
}
