:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --panel: #ffffff;
  --ink: #17201a;
  --muted: #637064;
  --line: #d9dfd4;
  --brand: #1f6f50;
  --brand-soft: #dcece4;
  --blocked: #b42318;
  --blocked-soft: #fff0ed;
  --stale: #9a5b00;
  --stale-soft: #fff5df;
  --private: #4257a8;
  --shadow: 0 12px 28px rgba(23, 32, 26, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  background: rgba(246, 247, 242, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

#meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.view-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 172px;
  min-width: 172px;
  padding: 3px;
  background: #e8ece4;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.view-toggle button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.view-toggle button.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(23, 32, 26, 0.12);
}

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px;
}

section + section {
  margin-top: 22px;
}

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

.count,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e8ece4;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.today-list,
.project-grid {
  display: grid;
  gap: 12px;
}

.project-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card.blocked {
  border-color: #f4b6ae;
  background: var(--blocked-soft);
}

.card.stale:not(.blocked) {
  border-color: #f0cc7b;
  background: var(--stale-soft);
}

.card.private-card {
  border-color: #bbc4ef;
}

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

.card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.badge.priority-p1 {
  background: var(--brand-soft);
  color: var(--brand);
}

.badge.blocked-badge {
  background: var(--blocked);
  color: #fff;
}

.badge.stale-badge {
  background: var(--stale);
  color: #fff;
}

.badge.private-badge {
  background: #e7eaff;
  color: var(--private);
}

.field {
  display: grid;
  gap: 4px;
}

.label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.value {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.card-footer a {
  flex: 0 0 auto;
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
}

.card-footer a:focus,
.card-footer a:hover {
  text-decoration: underline;
}

.today-card {
  grid-template-columns: auto 1fr;
  align-items: start;
}

.rank {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.why {
  color: var(--muted);
  font-size: 13px;
}

.empty,
.error {
  padding: 18px;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .view-toggle {
    width: 100%;
  }

  main {
    padding: 14px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .card-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
