/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #ffffff;
  --surface: #f6f8fa;
  --card: #ffffff;
  --border: #d0d7de;
  --text: #1f2328;
  --muted: #59636e;
  --accent: #0969da;
  --danger: #cf222e;
  --warn: #fff8c5;
  --shadow: 0 1px 2px rgba(31, 35, 40, .07);
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --card: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --muted: #9198a1;
    --accent: #4493f8;
    --danger: #f85149;
    --warn: #272115;
    --shadow: 0 1px 2px rgba(1, 4, 9, .4);
  }
}

/* ----------------------------------------------------------------- base */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

h1 { font-size: 20px; margin: 0 0 8px; }
p { margin: 8px 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 14px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

button, select, input {
  font: inherit;
  color: inherit;
  min-height: 40px;             /* tap target floor */
}

button { cursor: pointer; }

.ghost {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.ghost:active { background: var(--surface); }

/* --------------------------------------------------------------- header */
.bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.sticky { position: sticky; top: 0; z-index: 5; }

.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
}

.bar-row + .bar-row { padding-top: 0; }

.bar-title { flex: 1; font-weight: 600; }

.title-btn {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-weight: 600;
  background: none;
  border: 0;
  padding: 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#lane-select {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 8px;
  font-size: 14px;
}

/* -------------------------------------------------------------- notices */
.notice {
  position: relative;
  margin: 10px;
  padding: 10px 40px 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
}

.notice.warn { background: var(--warn); }
.notice.err { border-color: var(--danger); color: var(--danger); }

.dismiss {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  min-width: 40px;
  background: none;
  border: 0;
  font-size: 20px;
  line-height: 1;
}

/* --------------------------------------------------------- token screen */
#token-form { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }

#token-form label { font-size: 13px; color: var(--muted); }

#token-input {
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  font-size: 16px;              /* keeps iOS from zooming on focus */
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

#token-submit {
  min-height: 44px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  font-weight: 600;
}

/* -------------------------------------------------------------- picker */
.group {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 18px 0 6px;
}

.plist {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.pitem {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border);
}

.plist li:last-child .pitem { border-bottom: 0; }
.pitem:active { background: var(--surface); }
.pname { flex: 1; min-width: 0; }

/* --------------------------------------------------------------- lanes */
.lane { border-bottom: 1px solid var(--border); }

.lane-h { margin: 0; font-size: 15px; font-weight: 600; }

.lane-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  text-align: left;
  font-weight: 600;
  background: var(--surface);
  border: 0;
}

.lane-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chev { color: var(--muted); transform: rotate(90deg); transition: transform .15s; }
.lane.collapsed .chev { transform: rotate(0deg); }
.lane.collapsed .lane-body { display: none; }

.count {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
}

/* ------------------------------------------------------------- columns */
.lane-body {
  display: flex;
  gap: 10px;
  padding: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 10px;
  -webkit-overflow-scrolling: touch;
}

.col {
  flex: 0 0 80vw;               /* leaves a sliver of the next column visible */
  max-width: 340px;
  scroll-snap-align: start;
}

.col-h {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.col-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.col-items { display: flex; flex-direction: column; gap: 8px; }

.empty {
  margin: 0;
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* --------------------------------------------------------------- cards */
.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}

.card:active { border-color: var(--accent); }
.card.restricted { opacity: .65; }

.card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.35;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  font-size: 12px;
  color: var(--muted);
}

.ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.st-open { background: #3fb950; }
.st-merged { background: #a371f7; }
.st-closed { background: #f85149; }
.st-draft { background: #8b949e; }

.avatars { display: inline-flex; margin-left: auto; padding-left: 6px; }

.avatars img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--card);
}

.avatars img + img { margin-left: -6px; }

.labels { display: flex; flex-wrap: wrap; gap: 4px; }

.chip {
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.3;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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