:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1b2030;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2f6feb;
  --accent-ink: #ffffff;
  --danger: #c43a3a;

  --s-todo: #9aa0a6;
  --s-inprogress: #2f6feb;
  --s-waiting: #b48400;
  --s-blocked: #c43a3a;
  --s-done: #2e8b57;

  --p-low: #9aa0a6;
  --p-medium: #2f6feb;
  --p-high: #c43a3a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 15px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--ink);
}
.nav a.active, .nav a:hover { background: #eef2ff; text-decoration: none; }
.user { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.user b { color: var(--ink); }

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

button, .primary, .link {
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
button {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--ink);
}
button:hover { background: #f0f2f7; }
button.primary, .primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
button.primary:hover, .primary:hover { filter: brightness(0.95); }
button.danger { background: var(--panel); color: var(--danger); border-color: var(--danger); }
button.danger:hover { background: #fff0f0; }
button.link, .link { background: none; border: none; color: var(--accent); padding: 0; }
button.link:hover { text-decoration: underline; }
.small { font-size: 12px; padding: 4px 10px; }
form.inline { display: inline; }

input, select, textarea {
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--panel);
  color: var(--ink);
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ===== Toolbar ===== */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--panel); padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filters .label { color: var(--muted); margin-right: 4px; }
.chip { padding: 4px 10px; border-radius: 999px; background: #eef2ff; color: var(--ink); font-size: 12px; }
.chip:hover { text-decoration: none; background: #e0e7ff; }
.chip.active { background: var(--accent); color: var(--accent-ink); }

.new-task summary { list-style: none; }
.new-task summary::-webkit-details-marker { display: none; }
.new-task-form { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr 2fr auto; gap: 8px; margin-top: 10px; }
@media (max-width: 900px) { .new-task-form { grid-template-columns: 1fr 1fr; } }

/* ===== Board ===== */
.board {
  display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px;
}
@media (max-width: 1100px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .board { grid-template-columns: 1fr; } }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-height: 200px; }
.col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.col-header h2 { font-size: 13px; margin: 0; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink); }
.col-header .count { background: #eef2ff; color: var(--ink); padding: 1px 8px; border-radius: 999px; font-size: 12px; }
.col-header.status-to-do h2 { color: var(--s-todo); }
.col-header.status-in-progress h2 { color: var(--s-inprogress); }
.col-header.status-waiting h2 { color: var(--s-waiting); }
.col-header.status-blocked h2 { color: var(--s-blocked); }
.col-header.status-done h2 { color: var(--s-done); }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--p-medium);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.card.priority-high { border-left-color: var(--p-high); }
.card.priority-low { border-left-color: var(--p-low); }
.card-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.card-title { font-weight: 600; color: var(--ink); display: block; margin-bottom: 4px; }
.card-title:hover { color: var(--accent); text-decoration: none; }
.next-step { color: var(--ink); font-size: 12.5px; margin-top: 4px; }
.next-step b { color: var(--muted); font-weight: 600; }
.card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 11px; }
.updated { color: var(--muted); }

.prio { padding: 1px 8px; border-radius: 999px; font-size: 11px; color: white; }
.prio-low { background: var(--p-low); }
.prio-medium { background: var(--p-medium); }
.prio-high { background: var(--p-high); }

.due { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #eef2ff; color: var(--ink); }
.due.due-soon { background: #fff3d1; color: #8a6500; }
.due.due-today { background: #ffe6cc; color: #a14a00; font-weight: 600; }
.due.due-overdue { background: #ffd6d6; color: var(--danger); font-weight: 600; }

.attachments { margin-top: 18px; }
.attachments h2 { font-size: 15px; margin: 0 0 8px; }
.attach-form { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.attach-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: 8px; }
.attach-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.attach-item:last-child { border-bottom: none; }
.attach-item .muted.small { flex: 1; font-size: 11px; }
.link.danger { color: var(--danger); }

/* ===== Table ===== */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: auto; }
.tasks-table { width: 100%; border-collapse: collapse; }
.tasks-table th, .tasks-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tasks-table th { background: #fafbfd; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.tasks-table tr:last-child td { border-bottom: none; }
.muted { color: var(--muted); }
.center { text-align: center; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; color: white; }
.pill.status-to-do { background: var(--s-todo); }
.pill.status-in-progress { background: var(--s-inprogress); }
.pill.status-waiting { background: var(--s-waiting); }
.pill.status-blocked { background: var(--s-blocked); }
.pill.status-done { background: var(--s-done); }

/* ===== Activity ===== */
.activity h1 { font-size: 18px; margin-top: 0; }
.feed { list-style: none; padding: 0; margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.feed-item { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: none; }
.feed-meta { color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.feed-body { color: var(--ink); }

/* ===== Task detail ===== */
.task-detail { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.task-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.back { color: var(--muted); }
.task-actions { display: flex; gap: 6px; }
.task-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 12px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.task-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.task-form .full { grid-column: 1 / -1; }
.task-form button { grid-column: 1 / -1; justify-self: end; }
@media (max-width: 700px) { .task-form { grid-template-columns: 1fr 1fr; } }

.updates { margin-top: 18px; }
.updates h2 { font-size: 15px; margin: 0 0 8px; }
.update-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.update-form button { align-self: flex-start; }
.update-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: 8px; }
.update { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.update:last-child { border-bottom: none; }

/* ===== Login ===== */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px 32px; min-width: 320px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 6px 24px rgba(0,0,0,0.06); }
.login-card h1 { font-size: 18px; margin: 0 0 8px; text-align: center; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.login-card button { margin-top: 8px; padding: 10px; }
.error { background: #fff0f0; color: var(--danger); border: 1px solid #f3c0c0; padding: 8px 10px; border-radius: 6px; font-size: 13px; }
