:root {
  --bg: #f6f7f9; --panel: #fff; --card: #fff; --text: #1c1e21; --muted: #6b7280;
  --line: #e2e5ea; --accent: #4a86e8; --shadow: 0 1px 2px rgb(0 0 0 / .08);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121417; --panel: #1a1d21; --card: #22262b; --text: #e6e8eb; --muted: #9aa1ab; --line: #30353c; --shadow: none; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, sans-serif; }
button, input, select { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
a { color: inherit; }

.top, .filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { margin-right: 8px; }
#add { display: flex; gap: 6px; flex: 1 1 420px; }
#add-title { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.filters label { display: flex; gap: 4px; align-items: center; color: var(--muted); }
#q { width: 180px; }

#main { padding: 12px 16px; overflow-x: auto; }
.board { display: grid; grid-template-columns: repeat(var(--cols), minmax(230px, 1fr)); gap: 0 10px; min-width: calc(var(--cols) * 240px); }
.colhead { position: sticky; top: 0; z-index: 1; background: var(--bg); padding: 6px 4px; font-weight: 600; border-top: 3px solid var(--c, var(--line)); display: flex; justify-content: space-between; }
.colhead span { color: var(--muted); font-weight: 400; }
.lane { grid-column: 1 / -1; margin: 14px 0 4px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.col { min-height: 60px; padding: 4px; border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.col.over { background: color-mix(in srgb, var(--accent) 12%, transparent); outline: 2px dashed var(--accent); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; box-shadow: var(--shadow); cursor: pointer; }
.card:focus-visible, .card:hover { border-color: var(--accent); outline: none; }
.card.dragging { opacity: .4; }
.card .title { display: block; margin-top: 3px; text-decoration: none; overflow-wrap: anywhere; }
.card .title:hover { text-decoration: underline; }
.meta { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.ref { color: var(--muted); font-size: 12px; }
.chip { border-radius: 10px; padding: 0 7px; font-size: 11px; line-height: 18px; background: var(--line); }
.avatar { width: 18px; height: 18px; border-radius: 50%; margin-left: auto; }

table.list { width: 100%; border-collapse: collapse; background: var(--panel); }
.list th, .list td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: var(--bg); }

dialog { width: min(640px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); padding: 16px; }
dialog::backdrop { background: rgb(0 0 0 / .4); }
.detail header { display: flex; justify-content: space-between; align-items: center; }
.detail h2 { font-size: 18px; margin: 6px 0 12px; }
.fields { display: flex; flex-wrap: wrap; gap: 12px; }
.fields label { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 12px; }
.labels { display: flex; flex-wrap: wrap; gap: 4px; }
.desc { white-space: pre-wrap; max-height: 40vh; overflow: auto; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }

#login { max-width: 360px; margin: 80px auto; text-align: center; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
.anon .top, .anon .filters { display: none; }
