:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: #f8f9fb;
  --surface: #ffffff;
  --border: #e4e7ec;
  --text: #1a202c;
  --muted: #667085;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --danger: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); }
button, input, select { font: inherit; }
button, summary, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.rail { position: sticky; top: 0; height: 100vh; padding: 20px 16px; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); }
.rail-brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.brand-mark { width: 34px; height: 34px; display: inline-grid; place-items: center; flex: 0 0 auto; color: white; background: var(--accent); border-radius: var(--radius); font-size: 13px; font-weight: 700; }
.rail nav { display: grid; gap: 2px; margin-top: 28px; }
.rail nav a { padding: 8px 10px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; border-radius: 6px; }
.rail nav a:hover { color: var(--text); background: #f2f4f7; }
.rail nav a.active { color: var(--accent); background: var(--accent-soft); }
.rail-user { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.rail-user p { margin: 0; overflow: hidden; }
.rail-user strong, .rail-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-user strong { font-size: 14px; font-weight: 600; }
.rail-user small { margin-top: 2px; color: var(--muted); font-size: 12px; text-transform: capitalize; }
.avatar { width: 32px; height: 32px; display: inline-grid; place-items: center; flex: 0 0 auto; color: white; background: #64748b; border-radius: 50%; font-size: 11px; font-weight: 600; }
.avatar.small { width: 24px; height: 24px; font-size: 9px; }

.workspace { min-width: 0; padding: 32px clamp(20px, 4vw, 48px) 56px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 13px; font-weight: 500; }
.topbar h1 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.board-dot { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; }
.topbar-tools { display: flex; align-items: center; gap: 10px; }
.link-button { display: block; margin-bottom: 6px; padding: 0; color: var(--muted); background: transparent; border: 0; font-size: 13px; font-weight: 500; }
.link-button:hover { color: var(--text); }

button { padding: 8px 14px; color: white; background: var(--accent); border: 1px solid var(--accent); border-radius: var(--radius); font-size: 14px; font-weight: 500; }
button:hover { background: #1d4fd7; }
button:disabled { cursor: not-allowed; opacity: .45; }
input, select { width: 100%; min-width: 0; padding: 8px 10px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
input::placeholder { color: #98a2b3; }
input:hover, select:hover { border-color: #cbd5e1; }

.error-banner { margin: 16px 0 0; padding: 10px 14px; color: #b42318; background: #fef3f2; border: 1px solid #fecdca; border-radius: var(--radius); font-size: 14px; }

.new-board { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 24px 0 8px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.new-board input { flex: 1 1 260px; }
.palette { display: flex; gap: 6px; }
.swatch { width: 24px; height: 24px; padding: 0; border: 2px solid transparent; border-radius: 50%; }
.swatch:hover { background: inherit; }
.swatch.selected { border-color: var(--text); }

.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 24px; }
.board-tile { display: grid; gap: 6px; justify-items: start; padding: 16px; text-align: left; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.board-tile:hover { background: var(--surface); border-color: #cbd5e1; box-shadow: 0 4px 8px rgba(16, 24, 40, .06); }
.board-tile strong { font-size: 16px; font-weight: 600; }
.board-tile small { color: var(--muted); font-size: 13px; }

.seed-card { max-width: 560px; margin: 28px 0; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.seed-card h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.seed-card p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }

.add-list { display: flex; align-items: center; gap: 10px; margin: 20px 0 0; max-width: 380px; }

.board { display: grid; grid-auto-columns: 280px; grid-auto-flow: column; align-items: start; gap: 14px; margin-top: 22px; padding-bottom: 20px; overflow-x: auto; }
.column { background: #f2f4f7; border: 1px solid var(--border); border-radius: 10px; }
.column > header { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.column > header h2 { margin: 0; flex: 1; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.column > header strong { min-width: 22px; padding: 1px 6px; text-align: center; color: var(--muted); background: white; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; font-weight: 500; }
.list-tools { display: flex; align-items: center; gap: 2px; }
.column-body { padding: 4px 10px 12px; }

.job-card { margin-bottom: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.job-card:hover { border-color: #cbd5e1; }
.job-topline { display: flex; align-items: center; justify-content: space-between; color: #98a2b3; font-size: 11px; }
.job-card h3 { margin: 8px 0 4px; font-size: 14px; font-weight: 600; line-height: 1.35; }
.job-card > p { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.job-controls { padding-top: 8px; border-top: 1px solid #f2f4f7; }
.job-controls label span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.job-controls select { padding: 5px 8px; font-size: 13px; }
.card-actions { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.icon-button { width: 26px; height: 26px; padding: 0; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 6px; font-size: 13px; }
.icon-button:hover { color: var(--text); background: #f2f4f7; border-color: var(--border); }
.icon-button:disabled { opacity: .3; }
.icon-button.danger:hover { color: var(--danger); background: #fef3f2; border-color: #fecdca; }
.delete-button { margin-left: auto; padding: 4px 6px; color: var(--muted); background: transparent; border: 0; border-radius: 6px; font-size: 12px; font-weight: 500; }
.delete-button:hover { color: var(--danger); background: #fef3f2; }
.delete-button.big { margin: 0; padding: 8px 14px; color: var(--danger); border: 1px solid #fecdca; font-size: 14px; }
.delete-button.big:hover { background: #fef3f2; }
.empty-column { margin: 18px 0; color: #98a2b3; text-align: center; font-size: 13px; }
.add-card { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.add-card input { background: transparent; border-color: transparent; font-size: 13px; }
.add-card input:hover, .add-card input:focus { background: var(--surface); border-color: var(--border); }
.add-card button { padding: 6px 12px; font-size: 13px; }

.members-panel { position: relative; }
.members-panel > summary { padding: 8px 14px; list-style: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; font-weight: 500; box-shadow: var(--shadow); }
.members-panel > summary::-webkit-details-marker { display: none; }
.members-panel > summary:hover { border-color: #cbd5e1; }
.members-panel[open] > summary { border-color: var(--accent); }
.members-body { position: absolute; right: 0; z-index: 5; min-width: 280px; margin-top: 6px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 20px rgba(16, 24, 40, .1); }
.members-body ul { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 8px; }
.members-body li { display: flex; align-items: center; gap: 8px; }
.member-name { flex: 1; font-size: 14px; }
.member-name small { color: var(--muted); font-size: 12px; }
.add-member { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.add-member button { padding: 6px 12px; font-size: 13px; }
.member-hint { margin: 0; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }

.center-state, .loading { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 4px; padding: 40px; text-align: center; background: var(--bg); }
.center-state .brand-mark, .loading .brand-mark { width: 44px; height: 44px; margin-bottom: 14px; font-size: 16px; }
.center-state h1 { margin: 4px 0; font-size: 30px; font-weight: 700; letter-spacing: -.01em; }
.center-state > p:not(.eyebrow) { max-width: 420px; margin: 4px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.center-state button { margin-top: 20px; padding: 10px 22px; }
.loading { color: var(--muted); }

@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .rail { position: static; width: 100%; height: auto; padding: 12px 16px; flex-direction: row; align-items: center; gap: 16px; }
  .rail nav { display: flex; margin: 0; }
  .rail-user { margin: 0 0 0 auto; padding: 0; border: 0; }
  .rail-user p { display: none; }
  .workspace { padding: 24px 16px 40px; }
  .topbar { flex-wrap: wrap; align-items: flex-start; }
  .board { grid-auto-columns: 85vw; }
  .members-body { right: auto; left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
