:root {
  --bg: #f4f5f7; --card: #fff; --text: #172b4d; --muted: #5e6c84; --line: #dfe1e6;
  --accent: #0c66e4; --stale: #fff4e5; --warn: #fff7d6; --error: #ae2a19;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
button { font: inherit; cursor: pointer; color: inherit; }

.top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tab { padding: 6px 12px; border-radius: 8px; color: var(--text); text-decoration: none; white-space: nowrap; }
.tab:hover { background: var(--bg); }
.tab.active { background: var(--accent); color: #fff; }
.tab.add { margin-left: 8px; border: 1px dashed var(--accent); background: none; color: var(--accent); }
.tab.add:hover { background: var(--bg); }
.count { opacity: .7; font-size: 13px; }
.status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.status form { margin: 0; }
.status button, .actions button, .actions select, .filters input, .filters select, .login input, .login button {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 10px; font: inherit; color: var(--text); }
button.link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; }
.warn { padding: 8px 16px; background: var(--warn); border-bottom: 1px solid #f5d76e; }

.filters { display: flex; gap: 8px; padding: 12px 16px 0; }
.filters input { flex: 1; min-width: 0; }
.list { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 80px; }
.tile { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; }
.tile:hover, .tile:focus-visible { border-color: var(--accent); }
.tile.stale { background: var(--stale); }
.tile-top { display: flex; gap: 8px; font-size: 12px; color: var(--muted); }
.label { border-left: 4px solid var(--c, #97a0af); padding-left: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.age { margin-left: auto; white-space: nowrap; }
.tile-name { font-weight: 600; }
.tile-comment { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.empty, .muted { color: var(--muted); }
.error { color: var(--error); }

.panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 10; width: min(560px, 100%); overflow-y: auto;
  padding: 16px 20px 40px; background: var(--card); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(9, 30, 66, .12); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.panel-head h2 { margin: 0; font-size: 19px; }
.close { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 12px 0; font-size: 14px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.note { white-space: pre-wrap; padding: 10px; margin-bottom: 12px; background: var(--bg); border-radius: 8px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 16px; }
.actions a { margin-left: auto; color: var(--accent); }
.new-task { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.new-task label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.new-task input, .new-task textarea, .new-task select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
  font: inherit; color: var(--text); background: var(--card); }
.new-task textarea { resize: vertical; }
.new-task .actions { margin: 0; }
.actions button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.timeline li { position: relative; padding: 0 0 14px 16px; border-left: 2px solid var(--line); }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline li.comment::before { background: var(--accent); }
.timeline time { display: block; font-size: 12px; color: var(--muted); }
.timeline .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline li.move { font-size: 14px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 20px; z-index: 20; transform: translateX(-50%); display: flex; align-items: center; gap: 14px;
  max-width: calc(100% - 32px); padding: 10px 16px; background: #172b4d; color: #fff; border-radius: 10px; }
.toast button { padding: 4px 10px; background: none; border: 1px solid rgba(255, 255, 255, .5); border-radius: 6px; color: #fff; }

.login-page { display: grid; place-items: center; min-height: 100vh; }
.login { display: flex; flex-direction: column; gap: 12px; width: min(340px, 100% - 32px); padding: 24px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; }
.login h1 { margin: 0 0 4px; font-size: 20px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.login .check { flex-direction: row; align-items: center; gap: 8px; }
.login button { background: var(--accent); border-color: var(--accent); color: #fff; padding: 8px; }

@media (max-width: 767px) {
  .top { padding: 8px; }
  .status { width: 100%; justify-content: space-between; }
  .filters { padding: 12px 8px 0; }
  .list { padding: 12px 8px 80px; }
  .panel { width: 100%; border-left: 0; }
}
