:root {
  --bg-app: oklch(0.985 0.003 250);
  --bg-board: oklch(0.975 0.004 250);
  --bg-col: oklch(0.97 0.004 250);
  --surface: #ffffff;
  --surface-2: oklch(0.985 0.003 250);
  --border: oklch(0.92 0.005 250);
  --border-strong: oklch(0.86 0.007 250);
  --border-hover: oklch(0.78 0.01 250);

  --text-1: oklch(0.22 0.012 260);
  --text-2: oklch(0.48 0.012 260);
  --text-3: oklch(0.62 0.012 260);
  --text-on-accent: #fff;

  --accent: oklch(0.55 0.13 255);
  --accent-bg: oklch(0.95 0.04 255);
  --accent-hover: oklch(0.5 0.14 255);

  --danger: oklch(0.6 0.16 25);
  --warning: oklch(0.68 0.14 75);
  --success: oklch(0.6 0.11 155);

  --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.04), 0 0 0 1px rgba(20, 24, 40, 0.03);
  --shadow-md: 0 4px 12px rgba(20, 24, 40, 0.06), 0 0 0 1px rgba(20, 24, 40, 0.04);
  --shadow-lg: 0 20px 50px rgba(20, 24, 40, 0.12), 0 0 0 1px rgba(20, 24, 40, 0.04);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --font-ui: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}
#root { height: 100%; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; letter-spacing: -0.01em; }
.muted { color: var(--text-3); }

/* ── App layout ─────────────────────────────────── */
.app {
  display: grid;
  grid-template-rows: 52px 40px 1fr;
  height: 100vh;
  background: var(--bg-app);
}

/* ── Top bar ────────────────────────────────────── */
.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 420px) auto;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; }
.topbar-center { display: flex; justify-content: center; }
.topbar-right { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.topbar-divider { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), oklch(0.45 0.16 270));
  color: white; display: grid; place-items: center;
}
.brand-name { font-weight: 600; font-size: 13px; }
.brand-name-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 1px solid transparent;
  padding: 1px 5px; margin: -1px -5px;
  border-radius: 4px;
  color: var(--text-1);
  text-align: left;
}
.brand-name-btn:disabled { cursor: default; }
.brand-name-btn > svg { opacity: 0; transition: opacity 0.15s; color: var(--text-3); }
.brand-name-btn.is-editable:hover { border-color: var(--border); background: var(--surface-2); }
.brand-name-btn.is-editable:hover > svg { opacity: 1; }
.brand-name-input {
  background: white;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1px 6px;
  margin: -2px -6px -2px -6px;
  font-size: 13px; font-weight: 600;
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-bg);
  width: 220px; max-width: 100%;
  color: var(--text-1);
}
.brand-meta { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  width: 100%;
  color: var(--text-3);
  transition: border 0.15s, background 0.15s;
}
.search:focus-within { border-color: var(--accent); background: white; box-shadow: 0 0 0 3px var(--accent-bg); }
.search input { flex: 1; border: none; outline: none; background: transparent; font-size: 12.5px; color: var(--text-1); }
.search input::placeholder { color: var(--text-3); }
.search-clear { background: transparent; border: none; padding: 2px; color: var(--text-3); border-radius: 4px; display: grid; place-items: center; }
.search-clear:hover { background: var(--border); color: var(--text-1); }
.search-sm { padding: 5px 8px; }

.tb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-sm); color: var(--text-2);
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border 0.15s;
}
.tb-btn:hover { background: var(--surface-2); color: var(--text-1); border-color: var(--border); }
.tb-btn.is-active { background: var(--accent-bg); color: var(--accent); border-color: transparent; }
.badge-dot {
  display: inline-grid; place-items: center;
  min-width: 16px; height: 16px; padding: 0 5px;
  background: var(--accent); color: white;
  font-size: 10px; font-weight: 600;
  border-radius: 9px;
  font-family: var(--font-mono);
}

.tb-icon-btn {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-sm); color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.tb-icon-btn:hover { background: var(--surface-2); color: var(--text-1); border-color: var(--border); }

.me-chip { display: flex; align-items: center; padding-left: 4px; }
.member-stack { padding: 0 4px; }

@media (max-width: 1100px) {
  .tb-btn > span:not(.badge-dot) { display: none; }
  .member-stack { display: none; }
  .topbar-divider { display: none; }
}

/* ── Popover ────────────────────────────────────── */
.filter-group { position: relative; }
.popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow: hidden;
}
.popover-sm { min-width: 200px; }
.popover-right { right: 0; left: auto; }
.popover-section { padding: 8px; border-bottom: 1px solid var(--border); }
.popover-section:last-child { border-bottom: none; }
.popover-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 8px; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.popover-list { display: flex; flex-direction: column; gap: 1px; max-height: 220px; overflow: auto; }
.popover-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; width: 100%;
  background: transparent; border: none;
  border-radius: var(--radius-sm); text-align: left;
  color: var(--text-1); font-size: 12.5px;
}
.popover-item:hover { background: var(--surface-2); }
.popover-item.is-on { background: var(--accent-bg); color: var(--accent); }
.popover-item.is-on .popover-item-label { color: var(--accent); }
.popover-item.is-danger { color: var(--danger); }
.popover-item-label { flex: 1; }
.popover-foot { padding: 8px; border-top: 1px solid var(--border); background: var(--surface-2); }
.toggle-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; }
.link-btn { background: none; border: none; color: var(--accent); font-size: 11px; font-weight: 500; }
.label-chip-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* ── Avatar ─────────────────────────────────────── */
.avatar {
  display: inline-grid; place-items: center;
  border-radius: 50%; color: white;
  font-weight: 600; font-family: var(--font-ui);
  flex-shrink: 0; user-select: none;
}
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-more { background: var(--border); color: var(--text-2); }

/* ── Board ──────────────────────────────────────── */
.board-wrap {
  overflow-x: auto; overflow-y: hidden;
  background: var(--bg-board);
  background-image:
    radial-gradient(circle at 1px 1px, oklch(0.88 0.006 250) 1px, transparent 0);
  background-size: 18px 18px;
}
.board {
  display: flex;
  gap: 12px;
  padding: 16px;
  height: 100%;
  min-width: max-content;
}

/* ── Column ─────────────────────────────────────── */
.column {
  width: 296px;
  display: flex; flex-direction: column;
  background: var(--bg-col);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-height: 100%;
  transition: background 0.15s, border 0.15s;
}
.column.is-drag-over {
  background: var(--accent-bg);
  border-color: var(--accent);
}
.col-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 10px 10px 12px;
  border-bottom: 1px solid var(--border);
}
.col-head-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.col-head-right { display: flex; gap: 2px; }
.col-marker { width: 8px; height: 8px; border-radius: 50%; background: var(--text-2); flex-shrink: 0; }
.col-name { background: none; border: none; padding: 0; font-size: 13px; font-weight: 600; color: var(--text-1); cursor: text; }
.col-name-input {
  background: white; border: 1px solid var(--accent); border-radius: 4px;
  padding: 2px 6px; font-size: 13px; font-weight: 600; outline: none;
  width: 140px;
}
.col-count { color: var(--text-3); font-size: 11px; }
.col-warn {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: rgba(193, 75, 75, 0.1); color: var(--danger);
  font-weight: 600;
}
.col-warn-soft { background: rgba(176, 122, 42, 0.1); color: var(--warning); }
.col-icon-btn {
  display: grid; place-items: center;
  width: 24px; height: 24px;
  background: transparent; border: none; border-radius: 4px;
  color: var(--text-3);
}
.col-icon-btn:hover { background: var(--surface-2); color: var(--text-1); }

.col-body {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px;
  overflow-y: auto;
  flex: 1;
}

/* ── Card ───────────────────────────────────────── */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border 0.15s, transform 0.1s, box-shadow 0.15s;
  display: flex; flex-direction: column; gap: 8px;
}
.card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); }
.card:active { cursor: grabbing; }
.card.is-archived { opacity: 0.55; }
.card.is-compact { padding: 8px 10px; gap: 5px; }
.card.is-compact .card-desc { display: none; }
.card.is-compact .progress { display: none; }

.card-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.label-chip {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 4px;
  font-size: 10.5px; font-weight: 600;
  color: var(--c);
  background: color-mix(in oklab, var(--c) 12%, transparent);
}

.card-title-row { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.card-title {
  font-size: 13.5px; font-weight: 600; color: var(--text-1);
  line-height: 1.4; text-wrap: pretty;
  flex: 1;
}
.card.is-compact .card-title { font-size: 12.5px; font-weight: 500; }
.card-desc {
  font-size: 12px; color: var(--text-3);
  line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.priority-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px; border-radius: 4px;
  font-size: 10.5px; font-weight: 600;
  flex-shrink: 0;
}
.priority-dot { width: 5px; height: 5px; border-radius: 50%; }

.progress { display: flex; align-items: center; gap: 8px; }
.progress-track { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.2s; }
.progress-num { font-size: 10.5px; color: var(--text-3); min-width: 28px; text-align: right; }

.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 2px;
}
.card-meta { display: flex; align-items: center; gap: 6px; color: var(--text-3); flex-wrap: wrap; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 4px; border-radius: 3px;
  font-size: 10.5px;
  color: var(--text-3);
}
.due-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 5px; border-radius: 3px;
  font-size: 10.5px; font-weight: 500;
  color: var(--text-2);
  background: var(--surface-2);
}
.due-soon { color: var(--warning); background: rgba(176, 122, 42, 0.08); }
.due-overdue { color: var(--danger); background: rgba(193, 75, 75, 0.08); font-weight: 600; }

.card-id {
  position: absolute; top: 6px; right: 8px;
  font-size: 9px; color: var(--text-3); opacity: 0;
  transition: opacity 0.15s;
}
.card:hover .card-id { opacity: 0.5; }

/* ── Add card form / button ─────────────────────── */
.add-card-form {
  background: white;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.add-card-form textarea {
  width: 100%; border: none; outline: none; resize: none;
  background: transparent; font-size: 12.5px;
  font-family: inherit; color: var(--text-1);
}
.add-card-actions { display: flex; gap: 6px; margin-top: 6px; }

.add-card-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 8px;
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-3); font-size: 12px;
  transition: background 0.15s, color 0.15s, border 0.15s;
}
.add-card-btn:hover { background: var(--surface); color: var(--text-1); border-color: var(--accent); border-style: solid; }

.add-column {
  width: 240px; min-height: 44px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-3); font-size: 12.5px; font-weight: 500;
  align-self: flex-start;
  transition: background 0.15s, color 0.15s, border 0.15s;
}
.add-column:hover { background: var(--surface); color: var(--accent); border-color: var(--accent); border-style: solid; }

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border 0.15s;
}
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); }

/* ── Detail panel ───────────────────────────────── */
.panel-scrim {
  position: fixed; inset: 0;
  background: rgba(20, 24, 40, 0.15);
  z-index: 60;
  animation: fadeIn 0.15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 90vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 70;
  display: flex; flex-direction: column;
  animation: slideIn 0.2s;
}
.detail-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.detail-head-meta { display: flex; align-items: center; gap: 10px; }
.pill-mono {
  font-size: 11px; padding: 2px 7px;
  background: var(--surface-2); color: var(--text-2);
  border-radius: 4px;
}
.detail-col-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); }
.detail-head-actions { display: flex; gap: 4px; }

.detail-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.detail-title {
  font-size: 18px; font-weight: 700; margin: 0 0 18px;
  line-height: 1.35; text-wrap: pretty;
}
.detail-title-input {
  width: 100%; border: 1px solid transparent;
  background: transparent;
  font-size: 18px; font-weight: 700; line-height: 1.35;
  padding: 2px 6px; margin: -2px -6px;
  border-radius: 4px; outline: none;
  color: var(--text-1);
}
.detail-title-input:hover { border-color: var(--border); }
.detail-title-input:focus { border-color: var(--accent); background: white; }

.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 22px;
}
.detail-field-wide { grid-column: 1 / -1; }
.detail-label {
  font-size: 10.5px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 6px; font-weight: 600;
}
.detail-value { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.detail-names { font-size: 12px; color: var(--text-2); }
.detail-labels { gap: 4px; }
.range { width: 100%; }
.priority-picker { display: inline-flex; gap: 2px; }
.priority-opt {
  background: transparent; border: 1px solid var(--border);
  padding: 2px 8px; font-size: 11px;
  border-radius: 4px; color: var(--text-2);
}
.priority-opt:hover { border-color: var(--accent); color: var(--accent); }
.priority-opt.is-on { background: var(--accent); border-color: var(--accent); color: white; }

.detail-section { margin-bottom: 22px; }
.detail-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.detail-section h3 { font-size: 13px; margin: 0; font-weight: 600; }
.detail-desc {
  width: 100%; min-height: 60px;
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); outline: none;
  font-size: 12.5px; line-height: 1.55;
  resize: vertical;
}
.detail-desc:focus { border-color: var(--accent); background: white; }
.detail-desc-readonly { font-size: 12.5px; line-height: 1.6; color: var(--text-2); margin: 0; }

.checklist { display: flex; flex-direction: column; gap: 4px; }
.checklist-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: var(--radius-sm);
  font-size: 12.5px;
  cursor: pointer;
}
.checklist-item:hover { background: var(--surface-2); }
.checklist-item input { position: absolute; opacity: 0; pointer-events: none; }
.checklist-box {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong); border-radius: 4px;
  display: grid; place-items: center;
  color: white; flex-shrink: 0;
}
.checklist-item.is-done .checklist-box { background: var(--accent); border-color: var(--accent); }
.checklist-item.is-done .checklist-text { text-decoration: line-through; color: var(--text-3); }

.activity { display: flex; flex-direction: column; gap: 10px; }
.activity-item { display: flex; gap: 10px; font-size: 12px; }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); margin-top: 6px; flex-shrink: 0; }
.activity-body div:first-child { color: var(--text-1); }
.activity-body .muted { font-size: 11px; margin-top: 1px; }

/* ── Modal ──────────────────────────────────────── */
.modal-scrim {
  position: fixed; inset: 0;
  background: rgba(20, 24, 40, 0.4);
  z-index: 80;
  animation: fadeIn 0.15s;
}
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 760px; max-width: 92vw;
  max-height: 86vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 90;
  display: flex; flex-direction: column;
  animation: fadeIn 0.2s;
  overflow: hidden;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { margin: 0; font-size: 15px; font-weight: 700; }
.modal-sub { font-size: 12px; margin-top: 2px; }
.modal-tabs {
  display: flex; gap: 4px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 12px; margin-bottom: -1px;
  background: transparent; border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-3); font-size: 12.5px; font-weight: 500;
}
.tab:hover { color: var(--text-1); }
.tab.is-on { color: var(--text-1); border-bottom-color: var(--accent); }
.tab-count {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--surface-2); color: var(--text-3);
  font-size: 10px; font-weight: 600;
  border-radius: 9px;
}
.tab.is-on .tab-count { background: var(--accent-bg); color: var(--accent); }

.banner {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 20px 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.banner-info {
  background: oklch(0.96 0.03 90);
  color: oklch(0.4 0.08 80);
  border: 1px solid oklch(0.88 0.06 90);
}

.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.modal-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; }
.modal-toolbar .search { max-width: 280px; }

.user-list {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden;
}
.user-list-head {
  display: grid; grid-template-columns: 1.4fr 1.4fr 1fr 60px;
  gap: 12px; padding: 8px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-3); font-weight: 600;
}
.user-row {
  display: grid; grid-template-columns: 1.4fr 1.4fr 1fr 60px;
  gap: 12px; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.user-row:last-child { border-bottom: none; }
.user-row:hover { background: var(--surface-2); }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-cell-right { justify-content: flex-end; gap: 6px; }
.user-name { font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.me-tag {
  font-size: 10px; padding: 1px 5px;
  background: var(--accent-bg); color: var(--accent);
  border-radius: 3px; font-weight: 600;
}
.pending-tag {
  font-size: 10px; padding: 1px 5px;
  background: oklch(0.94 0.04 80); color: oklch(0.5 0.12 70);
  border-radius: 3px; font-weight: 600;
}

.role-select {
  border: 1px solid var(--border);
  background: white;
  border-radius: var(--radius-sm);
  padding: 4px 8px; font-size: 12px;
  outline: none;
}
.role-select:focus { border-color: var(--accent); }
.role-pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 11px; font-weight: 600;
}
.icon-btn-soft {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  background: transparent; border: none;
  border-radius: 4px; color: var(--text-3);
}
.icon-btn-soft:hover { background: var(--border); color: var(--danger); }

.empty {
  padding: 40px; text-align: center;
  color: var(--text-3); font-size: 13px;
}

/* ── Roles tab ──────────────────────────────────── */
.role-cards {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.role-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: var(--surface);
}
.role-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.role-desc { font-size: 12px; color: var(--text-2); margin: 0 0 10px; line-height: 1.5; }
.role-perms { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 5px; }
.role-perms li {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px;
}
.role-perms li.on { color: var(--success); }
.role-perms li.off { color: var(--text-3); opacity: 0.6; }

/* ── Invite sheet ───────────────────────────────── */
.sub-scrim {
  position: absolute; inset: 0;
  background: rgba(20, 24, 40, 0.3);
  z-index: 91; animation: fadeIn 0.15s;
  border-radius: var(--radius-lg);
}
.invite-sheet {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 440px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 92;
  animation: fadeIn 0.2s;
}
.invite-form { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row > span { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.form-row input, .form-row select {
  height: 34px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: white; outline: none; font-size: 13px;
}
.form-row input:focus, .form-row select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ── Density tweak ──────────────────────────────── */
.app.density-compact .card { padding: 8px 10px; gap: 5px; }
.app.density-compact .card-desc, .app.density-compact .progress { display: none; }


/* ── View tabs ──────────────────────────────────── */
.viewtabs {
  display: flex; justify-content: space-between; align-items: stretch;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 40;
}
.viewtabs-inner { display: flex; gap: 2px; align-items: stretch; }
.viewtabs-right { display: flex; align-items: center; font-size: 11.5px; }
.viewtab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 100%; padding: 0 14px;
  background: transparent; border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-3); font-size: 12.5px; font-weight: 500;
  margin-bottom: -1px;
  transition: color 0.15s, border 0.15s;
}
.viewtab:hover { color: var(--text-1); }
.viewtab.is-on { color: var(--text-1); border-bottom-color: var(--accent); font-weight: 600; }

/* ── View wrap ─────────────────────────────────── */
.view-wrap { overflow: auto; background: var(--bg-board); }

/* ── Dashboard ─────────────────────────────────── */
.dashboard { padding: 20px; }
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
}
.kpi-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  position: relative; overflow: hidden;
}
.kpi-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 700; font-family: var(--font-mono); margin: 6px 0 2px; letter-spacing: -0.02em; color: var(--text-1); }
.kpi-sub { font-size: 11.5px; }
.kpi-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--border); }
.kpi-progress > div { height: 100%; background: var(--success); transition: width 0.3s; }
.kpi-danger .kpi-value { color: var(--danger); }
.kpi-info .kpi-value { color: var(--accent); }
.kpi-success .kpi-value { color: var(--success); }
.kpi-muted .kpi-value { color: var(--text-3); }

.dash-card {
  grid-column: span 4;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  min-height: 0;
}
.dash-col-wide { grid-column: span 8; }
.dash-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.dash-card-head h3 { margin: 0; font-size: 13px; font-weight: 600; }

/* Status bars */
.status-bars { display: flex; flex-direction: column; gap: 10px; }
.status-bar-row { display: grid; grid-template-columns: 120px 1fr 40px; align-items: center; gap: 12px; font-size: 12.5px; }
.status-bar-label { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.status-bar-track { height: 18px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.status-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.status-bar-num { text-align: right; font-size: 12px; color: var(--text-2); }

/* Donut */
.priority-donut { display: flex; align-items: center; gap: 20px; }
.donut { flex-shrink: 0; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.legend-row { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.legend-label { color: var(--text-2); }

/* Workload */
.workload { display: flex; flex-direction: column; gap: 9px; }
.workload-row { display: grid; grid-template-columns: 22px 1fr 80px 24px; align-items: center; gap: 8px; font-size: 12px; }
.workload-name { color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workload-track { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.workload-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.workload-num { text-align: right; color: var(--text-2); }

/* Upcoming */
.upcoming { display: flex; flex-direction: column; gap: 6px; }
.upcoming-row {
  display: grid; grid-template-columns: 86px 1fr auto;
  align-items: center; gap: 14px;
  padding: 8px 10px;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  text-align: left; cursor: pointer;
  transition: background 0.15s, border 0.15s;
}
.upcoming-row:hover { background: var(--surface-2); border-color: var(--border); }
.upcoming-date { padding: 4px 8px; border-radius: 4px; min-width: 0; }
.upcoming-day { font-size: 11.5px; font-weight: 600; color: var(--text-1); }
.upcoming-meta { font-size: 10px; color: var(--text-3); margin-top: 1px; }
.upcoming-normal { background: var(--surface-2); }
.upcoming-soon { background: rgba(176, 122, 42, 0.1); }
.upcoming-soon .upcoming-day, .upcoming-soon .upcoming-meta { color: var(--warning); }
.upcoming-overdue { background: rgba(193, 75, 75, 0.1); }
.upcoming-overdue .upcoming-day, .upcoming-overdue .upcoming-meta { color: var(--danger); }
.upcoming-title { font-size: 12.5px; font-weight: 500; }
.upcoming-sub { display: flex; align-items: center; gap: 8px; font-size: 11px; margin-top: 3px; }

/* Label stats */
.label-stats { display: flex; flex-direction: column; gap: 6px; }
.label-stat { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }

/* Recent */
.recent-list { display: flex; flex-direction: column; gap: 2px; }
.recent-row {
  display: grid; grid-template-columns: 60px 1fr auto auto;
  align-items: center; gap: 12px;
  padding: 8px 10px;
  background: transparent; border: none; border-radius: var(--radius-sm);
  text-align: left; font-size: 12.5px; color: var(--text-1);
  cursor: pointer;
}
.recent-row:hover { background: var(--surface-2); }
.recent-title { font-weight: 500; }

/* ── List view ─────────────────────────────────── */
.list-view { padding: 16px 20px 40px; max-width: 1400px; margin: 0 auto; }
.list-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
}
.list-toolbar-group { display: flex; align-items: center; gap: 10px; }
.seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.seg-btn {
  background: transparent; border: none;
  padding: 4px 10px; border-radius: 4px;
  color: var(--text-3); font-size: 12px;
}
.seg-btn:hover { color: var(--text-1); }
.seg-btn.is-on { background: var(--surface-2); color: var(--text-1); font-weight: 600; box-shadow: var(--shadow-sm); }

.list-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.list-head, .list-row {
  display: grid;
  grid-template-columns: 2.4fr 1fr 0.8fr 0.6fr 0.9fr 1fr 1.1fr;
  gap: 12px; align-items: center;
  padding: 8px 14px;
}
.list-head {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-3); font-weight: 600;
}
.lh-sort {
  background: transparent; border: none; padding: 0;
  color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit;
  cursor: pointer;
}
.lh-sort:hover { color: var(--text-1); }
.list-group { border-bottom: 1px solid var(--border); }
.list-group:last-child { border-bottom: none; }
.list-group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 12px; font-weight: 600;
}
.list-group-marker { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.list-row {
  background: transparent; border: none;
  border-top: 1px solid var(--border);
  text-align: left; font-size: 12.5px;
  cursor: pointer; color: var(--text-1);
  width: 100%;
}
.list-row:hover { background: var(--surface-2); }
.lr-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lr-title { gap: 8px; }
.lr-title-text { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-labels { flex-wrap: wrap; gap: 4px; }
.lr-progress { width: 100%; min-width: 80px; }
.status-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-2);
}
