/* Taskify — Trello-style visual system */

:root {
  --nav-height: 48px;
  --trello-blue: #0079BF;
  --trello-blue-dark: #026AA7;
  --trello-blue-darker: #055a8c;
  --surface: #f4f5f7;
  --surface-list: #ebecf0;
  --surface-card: #ffffff;
  --text: #172b4d;
  --text-muted: #5e6c84;
  --border: #dfe1e6;
  --danger: #eb5a46;
  --success: #61bd4f;
  --warning: #f2d600;
  --shadow-card: 0 1px 0 rgba(9, 30, 66, 0.25);
  --shadow-card-hover: 0 2px 4px rgba(9, 30, 66, 0.25), 0 0 1px rgba(9, 30, 66, 0.25);
  --shadow-pop: 0 8px 16px -4px rgba(9, 30, 66, 0.25), 0 0 1px rgba(9, 30, 66, 0.31);
  --radius: 8px;
  --radius-sm: 4px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--surface);
  font-size: 14px;
}

a { color: var(--trello-blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

h1, h2, h3, p { margin: 0 0 8px; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- Top Navigation ---------- */
.topnav {
  height: var(--nav-height);
  background: var(--trello-blue-dark);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
  position: relative;
  z-index: 50;
}

.topnav__logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  letter-spacing: 0.2px;
}

.topnav__logo-mark {
  width: 24px; height: 24px;
  border-radius: 5px;
  background: #fff;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
}
.topnav__logo-mark span { background: var(--trello-blue-dark); border-radius: 1px; }
.topnav__logo-mark span:nth-child(3) { opacity: .45; }

.topnav__spacer { flex: 1; }

.topnav__link {
  color: #fff;
  opacity: 0.92;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.topnav__link:hover { background: rgba(255,255,255,0.12); text-decoration: none; }

.topnav__user {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.6);
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; border-width: 1px; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; border-width: 1px; }

.usermenu-btn {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 50%;
}

.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  min-width: 220px;
  padding: 8px 0;
  display: none;
  z-index: 100;
}
.dropdown.open { display: block; }
.dropdown__header {
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}
.dropdown__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
}
.dropdown__item:hover { background: var(--surface); text-decoration: none; }
.dropdown__item--danger { color: var(--danger); }
.dropdown__item--danger:hover { background: var(--danger); color: #fff; }
.dropdown__divider { height: 1px; background: var(--border); margin: 8px 0; }

/* ---------- Notification bell ---------- */
.topnav__menu { position: relative; display: flex; align-items: center; }
.notif-bell-btn {
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 50%;
  line-height: 1;
  position: relative;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.notif-bell-btn:hover { background: rgba(255,255,255,0.12); }
.notif-bell-icon { display: block; }
.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.notif-dropdown { min-width: 320px; padding: 0; }
.notif-dropdown .dropdown__header { padding: 12px 16px 8px; }
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 16px 10px;
  font-size: 12px;
  color: var(--text-muted);
  user-select: none;
}
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch__track {
  position: relative;
  width: 32px;
  height: 18px;
  background: var(--border);
  border-radius: 10px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.toggle-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.toggle-switch input:checked + .toggle-switch__track { background: var(--trello-blue); }
.toggle-switch input:checked + .toggle-switch__track .toggle-switch__thumb { transform: translateX(14px); }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  display: block;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.notif-item:hover { background: var(--surface); text-decoration: none; }
.notif-item--unread { background: rgba(0,121,191,0.06); }
.notif-item__message { font-size: 13px; }
.notif-item--unread .notif-item__message { font-weight: 600; }
.notif-item__meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.notif-empty { padding: 20px 16px; text-align: center; font-size: 13px; }
.notif-dropdown #notif-mark-all-read { text-align: center; font-size: 12px; }

/* ---------- Notification preferences table ---------- */
.pref-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.pref-table th, .pref-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.pref-table th { font-size: 12px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.pref-table th:not(:first-child), .pref-table td:not(:first-child) { text-align: center; }

/* ---------- Buttons & Forms ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface-list);
  color: var(--text);
  transition: background .1s ease;
}
.btn:hover { background: #d6dbe1; text-decoration: none; }
.btn-primary { background: var(--trello-blue); color: #fff; }
.btn-primary:hover { background: var(--trello-blue-darker); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #cf513d; }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: #fafbfc;
}
.form-control:focus {
  outline: none;
  border-color: var(--trello-blue);
  background: #fff;
}
textarea.form-control { resize: vertical; min-height: 70px; font-family: inherit; }
select.form-control { background: #fff; }

.field-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-help { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  display: inline-block;
  width: 40px; height: 28px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
}
.swatch.selected { border-color: var(--text); box-shadow: 0 0 0 2px #fff inset; }

/* ---------- Alerts ---------- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
}
.alert-success { background: #e3fcef; color: #216e4e; border: 1px solid #baf3db; }
.alert-error { background: #ffebe6; color: #ae2e24; border: 1px solid #ffbdad; }

/* ---------- Auth pages ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--trello-blue) 0%, #4c9aff 100%);
  padding: 40px 16px;
}
.auth-logo {
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}
.auth-card h1 { font-size: 18px; text-align: center; margin-bottom: 20px; }
.auth-footer {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 16px 32px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  margin-top: 10px;
  font-size: 13px;
}

/* ---------- Dashboard ---------- */
.page {
  max-width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}
.page-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.page-header h1 { font-size: 20px; }

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.board-tile {
  height: 96px;
  border-radius: var(--radius-sm);
  padding: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: flex-start;
  position: relative;
  box-shadow: var(--shadow-card);
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.board-tile:hover { filter: brightness(1.08); text-decoration: none; }
.board-tile__meta {
  position: absolute;
  bottom: 10px;
  left: 12px;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.9;
}

.board-tile--new {
  background: var(--surface-list);
  color: var(--text-muted);
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border: none;
  cursor: pointer;
  width: 100%;
}
.board-tile--new:hover { background: #d6dbe1; }

.workspace-section { margin-bottom: 32px; }
.workspace-section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.workspace-section__title { font-size: 16px; margin: 0 0 12px; }
.workspace-section__header .workspace-section__title { margin-bottom: 0; }
.workspace-section__settings-link { font-size: 13px; }

/* ---------- Dashboard sidebar ---------- */
.dashboard-layout { display: flex; gap: 24px; align-items: flex-start; }
.dashboard-sidebar {
  width: 30%;
  max-width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dashboard-sidebar__item {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.dashboard-sidebar__item:hover { background: var(--surface); text-decoration: none; }
.dashboard-sidebar__item.active { background: var(--surface-list); color: var(--trello-blue-darker); }
.dashboard-sidebar__section-title {
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  margin: 16px 12px 4px;
}
.dashboard-content { flex: 1; min-width: 0; } 

/* ---------- Board favorite star (dashboard tiles + board topbar) ---------- */
.board-tile__favorite {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 16px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.board-tile__favorite:hover { color: #fff; }
.board-tile__favorite.is-favorite { color: var(--warning); }
.board-topbar__favorite {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 18px;
  line-height: 1;
  padding: 0;
  margin-left: 4px;
  cursor: pointer;
}
.board-topbar__favorite:hover { color: #fff; }
.board-topbar__favorite.is-favorite { color: var(--warning); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 30, 66, 0.54);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  overflow-y: auto;
  z-index: 200;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-pop);
  position: relative;
}
.modal--wide { max-width: 1140px; }
.modal__close {
  position: absolute;
  top: 10px; right: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  width: 32px; height: 32px;
  border-radius: 50%;
}
.modal__close:hover { background: var(--surface-list); }
.modal__body { padding: 24px; }
.card-detail-menu { position: absolute; top: 10px; right: 52px; }
.card-detail-menu__trigger {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  width: 32px; height: 32px;
  border-radius: 50%;
  line-height: 1;
}
.card-detail-menu__trigger:hover { background: var(--surface-list); }
.card-detail-menu .dropdown { min-width: 160px; }

/* ---------- Board layout ---------- */
.board-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.board-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(0,0,0,0.18);
  color: #fff;
}
.board-topbar h1 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: transparent;
  border: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.board-topbar h1:hover { background: rgba(255,255,255,0.16); }
.board-topbar__spacer { flex: 1; }
.member-stack { display: flex; }
.member-stack .avatar { margin-left: -8px; }
.member-stack .avatar:first-child { margin-left: 0; }

/* Icon-only topbar buttons (Filter/Members/Reports/Settings) — same line-icon treatment as
   the navbar's notification bell button. */
.board-icon-btn {
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 50%;
  line-height: 1;
  position: relative;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.board-icon-btn:hover { background: rgba(255,255,255,0.12); text-decoration: none; }
.board-icon-btn svg { display: block; }
.board-settings-menu { position: relative; }
.board-view-menu { position: relative; }
.dropdown__item--active { font-weight: 700; }

/* ---------- Board filter panel ---------- */
.filter-menu { position: relative; }
.filter-btn { position: relative; }
.filter-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.filter-panel { width: 320px; padding: 0; }
.filter-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.filter-panel__body { max-height: 480px; overflow-y: auto; padding: 12px 16px; }
.filter-section { margin-bottom: 16px; }
.filter-section:last-child { margin-bottom: 0; }
.filter-section__title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.filter-hint { font-size: 11px; margin-top: 4px; }
.filter-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.filter-check input { margin: 0; flex-shrink: 0; }
.filter-check--label { padding: 3px 0; }
.filter-label-pill {
  flex: 1;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}
.filter-due-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.filter-due-dot--overdue { background: var(--danger); }
.filter-due-dot--soon { background: #f2d600; }

.board-body {
  flex: 1;
  overflow-x: auto;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.list-column {
  position: relative;
  background: var(--surface-list);
  border-radius: var(--radius);
  width: 272px;
  flex: 0 0 272px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  max-height: 80dvh;
}
.list-column__resize-handle {
  position: absolute;
  top: 0;
  right: -6px;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  z-index: 5;
}
.list-column__resize-handle::after {
  content: '';
  position: absolute;
  top: 0;
  left: 5px;
  width: 2px;
  height: 100%;
  border-radius: 1px;
  background: transparent;
}
.list-column__resize-handle:hover::after,
.list-column--resizing .list-column__resize-handle::after {
  background: var(--trello-blue, #0079BF);
}
.list-column--resizing {
  user-select: none;
}
.list-column__resize-handle-v {
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 100%;
  height: 12px;
  cursor: row-resize;
  z-index: 5;
}
.list-column__resize-handle-v::after {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background: transparent;
}
.list-column__resize-handle-v:hover::after,
.list-column--resizing .list-column__resize-handle-v::after {
  background: var(--trello-blue, #0079BF);
}
.list-column__header {
  display: flex;
  align-items: center;
  padding: 4px 8px 8px;
  gap: 6px;
}
.list-column__title {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  border: none;
  background: transparent;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  width: 100%;
}
.list-column__title:hover, .list-column__title:focus { background: #fff; outline: none; }
.list-column__count {
  font-size: 12px;
  color: var(--text-muted);
  background: #fff;
  border-radius: 10px;
  padding: 1px 7px;
}
.list-column__menu-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  line-height: 1;
}
.list-column__menu-btn:hover { background: #d6dbe1; }

.card-list, .archived-card-list {
  list-style: none;
  margin: 0;
  padding: 0 4px;
  overflow-y: auto;
  flex: 1;
  min-height: 6px;
}
.card-list.drag-over { background: rgba(9,30,66,0.06); border-radius: var(--radius-sm); }
#archived-cards-lane { background: var(--surface-list); }
#archived-cards-lane .card-item { cursor: pointer; }

.card-item {
  background: var(--surface-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  position: relative;
}
.card-item:hover { box-shadow: var(--shadow-card-hover); }
.card-item__blocking-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  line-height: 0;
  background: #fff;
  border-radius: 50%;
}
.card-item.completed .card-item__title { text-decoration: line-through; color: var(--text-muted); }
.card-item.sortable-ghost { opacity: 0.4; }
.card-item__title-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.card-item__title { font-size: 14px; word-break: break-word; overflow-wrap: anywhere; line-height: 1.4; flex: 1; min-width: 0; }
.card-item__number { color: var(--text-muted); font-weight: 600; }
.card-item__complete-toggle {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #fff;
  color: transparent;
  font-size: 11px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s, background 0.1s, border-color 0.1s;
}
.card-item:hover .card-item__complete-toggle { opacity: 1; }
.card-item__complete-toggle:hover { border-color: var(--success); background: var(--success); color: #fff; }
.card-item.completed .card-item__complete-toggle {
  opacity: 1;
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}
.card-item__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-item__due {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-list);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-item__due.overdue { background: var(--danger); color: #fff; }
.card-item__due.soon { background: #fff3cd; color: #7a5c00; }
.card-item__avatars { margin-left: auto; display: flex; }
.card-item__avatars .avatar { margin-left: -6px; }

.add-card-form { padding: 4px 4px 0; }
.add-card-input {
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px;
  font-size: 14px;
  box-shadow: var(--shadow-card);
  margin-bottom: 6px;
}

.card-detail__main, .card-detail__sidebar{
    max-height: 80vh;
    overflow-y: scroll;
}

.add-card-actions { display: flex; align-items: center; gap: 8px; }
.add-trigger {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
}
.add-trigger:hover { background: rgba(9,30,66,0.08); color: var(--text); }

.list-add-column {
  width: 272px;
  flex: 0 0 272px;
}
.list-add-btn {
  width: 100%;
  background: rgba(255,255,255,0.24);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
}
.list-add-btn:hover { background: rgba(255,255,255,0.36); }
.new-list-form {
  background: var(--surface-list);
  border-radius: var(--radius);
  padding: 8px;
}

/* ---------- Card detail modal ---------- */
.card-detail { display: flex; gap: 24px; }
/* flex-basis percentages don't account for `gap` on their own — without subtracting it here,
   the two columns overflow their container by the full gap width, pushing the sidebar flush
   against the modal's edge instead of leaving the intended padding. */
.card-detail__main { flex: 0 0 calc(60% - 12px); min-width: 0; }
.card-detail__sidebar { flex: 0 0 calc(40% - 12px); min-width: 0; }
#card-title-input {
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.35;
  color: var(--text);
  border: none;
  background: transparent;
  width: 100%;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  resize: none;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}
#card-title-input:hover, #card-title-input:focus { background: #fff; outline: none; }

.card-detail__list-name {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 16px;
}
.card-detail__list-name select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none;
  background-color: var(--surface-list);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235e6c84' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border-radius: 12px;
  padding: 4px 26px 4px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}
.card-detail__list-name select:hover { background-color: #d6dbe1; }
.card-detail__list-name select:focus { outline: 2px solid var(--trello-blue); outline-offset: 1px; }
.card-detail__list-name select:disabled { cursor: default; opacity: 0.7; }
.cover-trigger {
  appearance: none;
  border: none;
  background-color: var(--surface-list);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235e6c84' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border-radius: 12px;
  padding: 4px 26px 4px 10px;
  min-width: 50px;
  height: 24px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  margin-left: 4px;
}
.cover-trigger:hover { filter: brightness(0.96); }
.cover-trigger:focus { outline: 2px solid var(--trello-blue); outline-offset: 1px; }

#cover-picker .swatch-row { align-items: center; }
.cover-none {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 0 10px;
  height: 28px;
  cursor: pointer;
}
.cover-none.selected, .cover-none:hover { border-color: var(--trello-blue); }
.card-detail__section { margin-bottom: 20px; }
.card-detail__section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.sidebar-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface-list);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 13px;
}
.sidebar-btn:hover { background: #d6dbe1; }

.assignee-chip, .member-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-list);
  border-radius: 14px;
  padding: 2px 10px 2px 2px;
  font-size: 12px;
  margin: 0 6px 6px 0;
}
.chip-remove {
  background: none; border: none; color: var(--text-muted); font-size: 13px; padding: 0 2px;
}

.activity-item { display: flex; gap: 8px; margin-bottom: 12px; font-size: 13px; }
.activity-item__body { flex: 1; min-width: 0; }
.activity-item__meta { color: var(--text-muted); font-size: 11px; }

.member-search-results {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 6px;
  max-height: 160px;
  overflow-y: auto;
  background: #fff;
}
.member-search-results__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13px;
}
.member-search-results__item:hover { background: var(--surface); }

.member-picker { position: relative; }
.member-picker__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 350;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  padding: 8px;
  margin-top: 2px;
}
.member-picker__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 2px 0 4px;
  padding: 0 2px;
}
.member-picker__list {
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
}
.member-picker__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13px;
}
.member-picker__item:hover { background: var(--surface); }
.member-picker__item--assigned { background: rgba(0, 121, 191, 0.06); }
.member-picker__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.member-picker__check { color: var(--trello-blue); font-weight: 700; }
.member-picker__empty { padding: 10px; font-size: 12px; }

.board-member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
}
.board-member-row__name { flex: 1; }
.board-member-row select { font-size: 12px; padding: 4px 6px; }

.text-muted { color: var(--text-muted); }
.mt-8 { margin-top: 8px; }
.mb-0 { margin-bottom: 0; }

@media (max-width: 640px) {
  .card-detail { flex-direction: column; }
  .card-detail__main, .card-detail__sidebar { flex: 1 1 auto; width: 100%; }
}

/* ---------- Phase 2: labels, covers, badges on mini cards ---------- */
.card-item.has-cover { padding-top: 0; overflow: hidden; }
.card-item__cover { height: 32px; margin: -12px -14px 8px; }
.card-item__cover--image { height: 120px; background-size: cover; background-position: center; background-repeat: no-repeat; }
.card-item__labels { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.card-item__label {
  display: inline-block;
  width: 32px; height: 8px;
  border-radius: 4px;
}
.card-item__label--named {
  width: auto; height: auto;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  line-height: 14px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}
.card-item__badge {
  font-size: 11px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.card-item__badge--done { color: var(--success); }
.card-item__custom-field {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

/* ---------- Label pills ---------- */
.label-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
  margin: 0 6px 6px 0;
}
#card-labels-list { display: flex; align-items: center; flex-wrap: wrap; gap: 0; }
#card-labels-list .btn { margin-bottom: 6px; }

/* ---------- Popover (label picker) ---------- */
.popover {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 12px;
  margin-top: 8px;
  z-index:2;
  max-width: 280px;
}
.popover__title { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.popover__divider { height: 1px; background: var(--border); margin: 10px 0; }
.checklist-item__menu-popover { padding: 4px 0; min-width: 160px; }
.popover-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
}
.popover-menu-item:hover { background: var(--surface); }
.label-picker__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
}

/* ---------- Card cover (detail view) ---------- */
.card-cover {
  height: 40px;
  border-radius: var(--radius) var(--radius) 0 0;
  margin: -24px -24px 12px -24px;
  background-size: cover;
  background-position: center;
}
.card-cover--image { height: 160px; background-repeat: no-repeat; }

/* ---------- Custom fields ---------- */
.custom-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}
.custom-field-row .form-label { margin-bottom: 0; flex-shrink: 0; }
.custom-field-row .form-control { max-width: 200px; }

/* ---------- Checklists ---------- */
.checklist { margin-bottom: 20px; }
.checklist__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.checklist__name { font-size: 14px; }
.checklist__progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.checklist__pct { font-size: 11px; color: var(--text-muted); width: 32px; }
.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--surface-list);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar__fill { height: 100%; background: var(--success); transition: width .15s ease; }
.checklist__items { list-style: none; margin: 0; padding: 0; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.checklist-item__text {
  flex: 1;
  border: none;
  background: transparent;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  min-width: 0;
}
.checklist-item__text:hover, .checklist-item__text:focus { background: var(--surface); outline: none; }
.checklist-item__text.completed { text-decoration: line-through; color: var(--text-muted); }
.checklist-item__control { position: relative; display: inline-flex; flex-shrink: 0; }
.checklist-item__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: none;
  border-radius: 12px;
  background: var(--surface-list);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.checklist-item__icon-btn:hover { background: #d6dbe1; }
.checklist-item__icon-btn .avatar { margin: -2px 0; }
.checklist-item__icon { font-size: 12px; line-height: 1; }
.checklist-item__due-trigger--set.overdue { background: var(--danger); color: #fff; }
.checklist-item__due-trigger--set.soon { background: #fff3cd; color: #7a5c00; }
.checklist-item__assignee-popover, .checklist-item__due-popover {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 360;
  margin-top: 4px;
  width: max-content;
}
.checklist-item__assignee-popover .member-picker__list { max-height: 200px; overflow-y: auto; }
.add-checklist-item-form { margin-top: 6px; }
.add-checklist-item-form input { width: 100%; }
#add-checklist-fields { display: inline-flex; gap: 8px; align-items: center; }
#add-checklist-fields input { max-width: 200px; }

/* ---------- Attachments ---------- */
.attachment-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.attachment-dropzone.drag-over { border-color: var(--trello-blue); background: rgba(0,121,191,0.06); }
.attachment-list { list-style: none; margin: 0; padding: 0; }
.attachment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.attachment-row:last-child { border-bottom: none; }
.attachment-row__thumb { width: 40px; height: 40px; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; }
.attachment-row__icon { font-size: 24px; width: 40px; text-align: center; flex-shrink: 0; }
.attachment-row__meta { flex: 1; min-width: 0; font-size: 13px; }
.attachment-row__meta a { word-break: break-all; }

/* ---------- Card dependencies ---------- */
.dependency-count {
  display: inline-block;
  background: var(--surface-list);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 4px;
}
.dependency-blocked-banner {
  background: #fff8e1;
  color: #8a6d00;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin: 6px 0;
}
.dependency-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.dependency-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  padding: 4px 6px;
}
.dependency-table td { padding: 6px; vertical-align: middle; border-top: 1px solid var(--border); }
.dependency-table__name button { text-align: left; word-break: break-word; }
.dependency-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px dashed var(--border);
  color: transparent;
  font-size: 11px;
  line-height: 1;
}
.dependency-status--done {
  border: none;
  background: var(--success);
  color: #fff;
}
.dependency-add { margin-top: 8px; position: relative; }
#dependency-picker { width: 280px; }
#dependency-picker .form-control { margin-bottom: 6px; }
.dependency-search-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.dependency-search-result:hover { background: var(--surface-list); }
.dependency-search-result__number { color: var(--text-muted); font-weight: 600; flex-shrink: 0; }
.dependency-search-result__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card-detail__number { color: var(--text-muted); font-size: 12px; font-weight: 700; padding: 0 6px; margin-bottom: -2px; }

/* ---------- Comments ---------- */
.comment-item__bubble {
  background: var(--surface-list);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.link-btn { background: none; border: none; color: var(--text-muted); font-size: 11px; padding: 0; text-decoration: underline; cursor: pointer; }
.comment-editor { position: relative; margin-top: 6px; margin-bottom: 10px;}

/* Cascaded reply thread: indented under the parent comment with a connecting line, matching
   a standard nested-comment layout. */
.comment-item__replies {
  margin-top: 10px;
  padding-left: 20px;
  border-left: 2px solid var(--border);
}
.comment-item__replies .comment-item--reply { margin-bottom: 12px; }
.comment-item__replies .comment-item--reply:last-child { margin-bottom: 0; }

/* Comment bodies are stored as sanitized Quill HTML but rendered as static markup (not a
   live Quill instance), so list markers/headings need plain-CSS equivalents of Quill's
   .ql-ui-based rendering. The .comment-body.ql-editor compound selector outranks Quill's
   own single-class .ql-editor rules regardless of stylesheet load order. */
.comment-body.ql-editor { white-space: normal; padding: 0; height: auto; overflow-y: visible; }
.comment-body.ql-editor p { margin: 0 0 4px; }
.comment-body.ql-editor h1, .comment-body.ql-editor h2, .comment-body.ql-editor h3 { margin: 4px 0; }
.comment-body.ql-editor ol { counter-reset: comment-list; padding-left: 1.4em; margin: 0 0 4px; }
.comment-body.ql-editor li[data-list] { list-style: none; position: relative; }
.comment-body.ql-editor li[data-list="ordered"] { counter-increment: comment-list; }
.comment-body.ql-editor li[data-list="ordered"]:before { content: counter(comment-list) '. '; position: absolute; left: -1.4em; }
.comment-body.ql-editor li[data-list="bullet"]:before { content: '\2022'; position: absolute; left: -1.2em; }
.comment-body.ql-editor img { max-width: 100%; border-radius: var(--radius-sm); margin: 4px 0; display: block; }
.comment-body.ql-editor a { color: var(--trello-blue); }

/* ---------- Board settings: labels & custom fields management ---------- */
.board-label-row, .board-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
}
.archived-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.archived-item-row__name { flex: 1; }
.archived-item-row__name--btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.archived-item-row__name--btn:hover { text-decoration: underline; }

.invitation-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.invitation-row__swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.invitation-row__text { flex: 1; font-size: 14px; }
.board-label-edit, .board-field-edit {
  padding: 8px 10px;
  margin-bottom: 6px;
  background: var(--surface-list);
  border-radius: var(--radius-sm);
}

/* ---------- Phase 3: rich text editors (description + comment share this) ---------- */
.description-editor { position: relative; }
.rich-editor-toolbar {
  border: 1px solid var(--border) !important;
  border-bottom: none !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--surface-list);
  padding: 6px 8px !important;
}
.rich-editor-toolbar .rich-editor-attach-file {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  width: 28px;
  height: 24px;
}
.rich-editor-toolbar .rich-editor-attach-file:hover { color: var(--trello-blue-dark); }
.rich-editor-body.ql-container {
  border: 1px solid var(--border) !important;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: #fff;
}
.rich-editor-body .ql-editor {
  min-height: 100px;
  font-size: 14px;
  font-family: inherit;
}
.rich-editor-body .ql-editor.ql-blank::before {
  color: var(--text-muted);
  font-style: normal;
}
.comment-editor .rich-editor-body .ql-editor { min-height: 130px; }
/* Read-only (no toolbar rendered): keep the same look as the editable state minus the toolbar radius. */
.description-editor[data-can-edit="0"] #card-description-editor.ql-container {
  border-radius: var(--radius-sm);
}

.mention-popover {
  z-index: 400;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  max-height: 200px;
  overflow-y: auto;
  min-width: 220px;
}
.mention-popover .member-search-results__item.active { background: var(--surface); }

/* ---------- Due date field: date input + optional time toggle ---------- */
.due-date-field { display: flex; align-items: center; gap: 6px; }
.due-date-field__date {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  width: 130px;
  background: #fafbfc;
}
.due-date-field__date:focus { outline: none; border-color: var(--trello-blue); background: #fff; }
.due-date-field__time-toggle {
  background: var(--surface-list);
  border: none;
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.due-date-field__time-toggle:hover { background: #d6dbe1; }
.due-date-field__time-toggle.active { background: var(--trello-blue); color: #fff; }
.due-date-field__time {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  font-size: 13px;
  font-family: inherit;
  width: 100px;
  background: #fafbfc;
}
.due-date-field__time:focus { outline: none; border-color: var(--trello-blue); background: #fff; }
.due-date-field__clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  flex-shrink: 0;
}
.due-date-field__clear:hover { color: var(--danger); }

.due-date-field--compact { gap: 4px; }
.due-date-field--compact .due-date-field__date { width: 92px; font-size: 11px; padding: 4px 6px; border-width: 1px; }
.due-date-field--compact .due-date-field__time-toggle { width: 24px; height: 24px; font-size: 11px; }
.due-date-field--compact .due-date-field__time { width: 84px; font-size: 11px; padding: 4px; border-width: 1px; }
.due-date-field--compact .due-date-field__clear { font-size: 15px; padding: 2px 4px; }

/* jQuery UI datepicker: enlarged, restyled to match the app rather than the OS-default look. */
.ui-datepicker {
  z-index: 1000 !important;
  width: 280px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  font-family: inherit;
}
.ui-datepicker .ui-datepicker-header { background: none; border: none; padding: 0 0 8px; }
.ui-datepicker .ui-datepicker-title { font-size: 15px; font-weight: 700; color: var(--text); }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next {
  top: 0;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
}
.ui-datepicker .ui-datepicker-prev:hover, .ui-datepicker .ui-datepicker-next:hover { background: var(--surface-list); border: none; }
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { margin-top: -6px; }
.ui-datepicker table { font-size: 13px; margin: 6px 0 0; }
.ui-datepicker th { padding: 6px 0; color: var(--text-muted); font-weight: 600; }
.ui-datepicker td { padding: 2px; }
.ui-datepicker td a, .ui-datepicker td span {
  text-align: center;
  padding: 8px 0;
  border-radius: var(--radius-sm);
}
.ui-datepicker td a.ui-state-default { border: none; background: none; }
.ui-datepicker td a.ui-state-default:hover { background: var(--surface-list); border: none; }
.ui-datepicker td a.ui-state-active { background: var(--trello-blue) !important; color: #fff !important; }
.ui-datepicker-calendar .ui-datepicker-today a { background: var(--surface-list); font-weight: 700; }

/* ---------- Phase 3: role management (/admin/roles) ---------- */
.role-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.role-row__main { flex: 1; min-width: 0; }
.role-row__actions { display: flex; gap: 6px; flex-shrink: 0; }
.role-edit {
  padding: 12px;
  margin-bottom: 10px;
  background: var(--surface-list);
  border-radius: var(--radius-sm);
}
.perm-fieldset {
  display: inline-block;
  vertical-align: top;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px 10px;
  margin: 0 10px 10px 0;
  min-width: 180px;
}
.perm-fieldset legend {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 4px;
}
.perm-checkbox { display: block; font-size: 13px; padding: 3px 0; }
.perm-checkbox input { margin-right: 6px; }

/* ---------- Phase 3: reports (/reports, /boards/{id}/reports) ---------- */
.stat-tiles {
  display: flex;
  gap: 12px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.stat-tile {
  flex: 1;
  min-width: 120px;
  background: var(--surface-list);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}
.stat-tile__value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-tile__label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; margin-top: 4px; }
.report-table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; }
.report-table th, .report-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.report-table th { font-size: 12px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.activity-bars { margin: 12px 0 20px; }
.activity-bar-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.activity-bar-row__date { width: 60px; flex-shrink: 0; font-size: 12px; color: var(--text-muted); }
.activity-bar-row__count { width: 30px; flex-shrink: 0; font-size: 12px; text-align: right; color: var(--text-muted); }
.activity-bar-row .progress-bar { flex: 1; }

.filter-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 16px 0; }
.filter-form__field { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.filter-form__field .form-control { min-width: 140px; }
.filter-form__actions { flex-direction: row; gap: 8px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 16px 0; }

/* ---------- Board Table View ---------- */
.board-table-wrap {
  margin: 16px 24px;
  padding: 8px 16px;
  background: var(--surface-card);
  border-radius: var(--radius);
  overflow-x: auto;
}
.board-table { width: 100%; border-collapse: collapse; }
.board-table th, .board-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.board-table th {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
}
.board-table__sort-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0;
  margin-left: 4px;
  cursor: pointer;
  vertical-align: middle;
}
.board-table__sort-btn svg { display: inline-block; transition: transform 0.1s; }
.board-table__sort-btn.sort-desc svg { transform: rotate(180deg); }
.table-row { cursor: pointer; }
.table-row:hover { background: var(--surface-list); }
.table-row.completed .table-row__card { text-decoration: line-through; color: var(--text-muted); }
.table-row .label-pill { margin: 0 4px 4px 0; }
.table-row__due-inner { display: flex; align-items: center; gap: 6px; }
.due-toggle {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #fff;
  color: transparent;
  font-size: 11px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s, background 0.1s, border-color 0.1s;
}
.table-row:hover .due-toggle { opacity: 1; }
.due-toggle:hover { border-color: var(--success); background: var(--success); color: #fff; }
.table-row.completed .due-toggle { opacity: 1; border-color: var(--success); background: var(--success); color: #fff; }

/* A thin, low-visual-weight boundary between rows — hovering it reveals a "+" near the Card
   column to insert a new card at that exact position (Table View only; Board View still adds
   cards via each list's own bottom "+ Add a card" button). */
.table-row-gap { height: 6px; }
.table-row-gap td { padding: 0; border-bottom: none; }
.table-row-gap__cell { position: relative; }
.table-row-gap__add-btn {
  opacity: 0;
  position: absolute;
  left: 8px;
  top: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: opacity 0.1s;
  z-index: 1;
}
.table-row-gap:hover .table-row-gap__add-btn { opacity: 1; }
.table-row-gap__add-btn:hover { border-color: var(--trello-blue); color: var(--trello-blue); }

.table-row-gap__popover {
  position: absolute;
  top: 100%;
  left: 8px;
  z-index: 20;
  width: 260px;
  cursor: default;
}
.table-row-gap__input {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.table-row-gap__field { margin-bottom: 10px; }
.table-row-gap__field .form-label { font-size: 12px; margin-bottom: 4px; }
.table-row-gap__actions { display: flex; gap: 8px; margin-top: 4px; }

/* ---------- Board print view ---------- */
@media print {
  .topnav,
  .modal-overlay,
  .dropdown,
  .board-topbar .board-icon-btn,
  .board-topbar .board-topbar__favorite,
  .board-topbar .filter-menu,
  .board-topbar .board-view-menu,
  .board-topbar .board-settings-menu,
  .board-topbar .member-stack,
  .list-column__menu-btn,
  .add-card-form {
    display: none !important;
  }
  .board-page { min-height: auto !important; }
  .board-page-bg { background: #fff !important; }
  .board-topbar { background: none !important; color: #000 !important; }
  .board-body { display: block !important; overflow: visible !important; padding: 0 !important; }
  .list-column {
    width: 100% !important;
    flex: none !important;
    max-height: none !important;
    box-shadow: none !important;
    margin-bottom: 16px;
    page-break-inside: avoid;
  }
  .card-list { overflow: visible !important; flex: none !important; }
  .card-item { box-shadow: none !important; border: 1px solid var(--border); }
}
