:root {
  color-scheme: light dark;
  --bg: #f7f7f5;
  --fg: #1f2328;
  --muted: #6b7280;
  --border: #e2e2df;
  --accent: #2f6f4f;
  --accent-fg: #ffffff;
  --overdue: #b3261e;
  --due-soon: #a15c00;
  --card-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --fg: #e6e6e6;
    --muted: #9aa0a6;
    --border: #2c2f34;
    --accent: #4caf7d;
    --accent-fg: #0b1210;
    --overdue: #ff6b6b;
    --due-soon: #f0a94e;
    --card-bg: #1e2126;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

.topbar {
  position: relative;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}

.topbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
  text-decoration: none;
}

.menu-toggle {
  background: transparent;
  border: none;
  padding: 0.5rem;
  margin: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--fg);
  border-radius: 1px;
}

#nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 20;
}

#nav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

#nav-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 1rem;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  padding: 0.4rem 1rem;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 30;
}

#nav-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#nav-menu a,
#nav-menu span {
  padding: 0.65rem 0;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

#nav-menu a:last-child,
#nav-menu span:last-child {
  border-bottom: none;
}

#nav-menu a:hover { text-decoration: underline; }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.status-overdue { color: var(--overdue); font-weight: 600; }
.status-due-soon { color: var(--due-soon); font-weight: 600; }
.status-upcoming { color: var(--muted); }

.board {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: center;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.board-column {
  flex: 0 0 260px;
  width: 260px;
}

.board-more {
  display: inline-block;
  margin-top: 0.25rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.board-more:hover { text-decoration: underline; }

@media (max-width: 700px) {
  .board {
    flex-direction: column;
    overflow-x: visible;
  }

  .board-column {
    width: 100%;
    flex: none;
  }
}

.board-column-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--fg);
  margin-bottom: 0.75rem;
}

.board-column-header:hover .board-column-name { text-decoration: underline; }

.board-column-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1.4rem;
}

.item-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.6rem;
}

.item-card-title { font-weight: 600; }

.item-card-meta { margin: 0.15rem 0 0.35rem; }

.item-card form { margin-top: 0.5rem; }

form.inline { display: inline; }

label { display: block; margin: 0.75rem 0 0.25rem; font-weight: 600; }

input, select, textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--fg);
  font-size: 1rem;
}

button, .button {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}

button:hover, .button:hover { opacity: 0.9; }

.actions { margin-top: 1.25rem; display: flex; gap: 0.75rem; }

.error { color: var(--overdue); margin: 0.5rem 0; }

.muted { color: var(--muted); }

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

.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.activity-list li:last-child { border-bottom: none; }
