:root {
  --bg: #0f172a;
  --panel: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --line: #1f2937;
  --accent: #22c55e;
  --danger: #ef4444;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

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

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

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.tab {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: .4rem .65rem;
  border-radius: 8px;
}

.tab.active, .tab:hover {
  color: var(--text);
  border-color: var(--accent);
}

.btn, button {
  background: var(--accent);
  color: #06220f;
  border: 0;
  border-radius: 8px;
  font-weight: 600;
  padding: .5rem .8rem;
  cursor: pointer;
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.task-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.task-table th, .task-table td {
  border-top: 1px solid var(--line);
  text-align: left;
  padding: .55rem .45rem;
  vertical-align: top;
  white-space: nowrap;
}

.task-table th:nth-child(2),
.task-table td:nth-child(2),
.task-table th:nth-child(7),
.task-table td:nth-child(7),
.task-table th:nth-child(8),
.task-table td:nth-child(8) {
  white-space: normal;
}

.task-table .first-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--panel);
}

.task-table thead .first-col {
  z-index: 2;
}

.title { font-weight: 600; }
.small { font-size: .85rem; }
.muted { color: var(--muted); }

.pill {
  font-size: .8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .1rem .5rem;
}

.tag {
  display: inline-block;
  margin-right: .35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .78rem;
  color: var(--muted);
  padding: .1rem .4rem;
}

.actions-cell {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.actions-cell form { margin: 0; }
.link-danger {
  background: transparent;
  color: var(--danger);
  border: none;
  padding: 0;
}

.icon-btn {
  min-width: 2rem;
}

.inline-form,
.stack-form {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: 1rem;
}

.stack-form {
  flex-direction: column;
}

.form-actions {
  display: flex;
  gap: .6rem;
  align-items: center;
}

.button-link {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 600;
  padding: .5rem .8rem;
  text-decoration: none;
}

.button-link:hover {
  border-color: var(--accent);
}

input, select, textarea {
  background: #0b1220;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .5rem .6rem;
}

.stack-form input, .stack-form select, .stack-form textarea {
  width: min(760px, 100%);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: .7rem;
}

.error {
  color: #fecaca;
  background: #450a0a;
  border: 1px solid #7f1d1d;
  border-radius: 8px;
  padding: .5rem .6rem;
}

.color-chip {
  display: inline-block;
  width: .9rem;
  height: .9rem;
  border-radius: 999px;
  border: 1px solid #000;
  vertical-align: middle;
}

.flash-stack {
  display: grid;
  gap: .5rem;
  margin-bottom: .85rem;
}

.flash {
  border-radius: 8px;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
}

.flash-success {
  color: #bbf7d0;
  background: #052e16;
  border-color: #166534;
}

.flash-error {
  color: #fecaca;
  background: #450a0a;
  border-color: #7f1d1d;
}

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

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .container {
    width: 94vw;
  }

  .panel {
    padding: .75rem;
  }

  .inline-form > * {
    flex: 1 1 100%;
    min-width: 0;
  }

  .inline-form button {
    width: 100%;
  }

  .actions-cell {
    gap: .35rem;
    flex-wrap: wrap;
  }

  .task-table {
    min-width: 680px;
  }

  .task-table th,
  .task-table td {
    padding: .5rem .4rem;
    font-size: .9rem;
  }
}
