
    :root {
      --page: #f7f6f2;
      --surface: #ffffff;
      --surface-muted: #f2f1ec;
      --text: #252522;
      --muted: #6d6c66;
      --border: #deddd6;
      --border-strong: #c8c6bd;
      --primary: #1f6f5f;
      --primary-dark: #155446;
      --danger: #b42318;
      --danger-bg: #fff1ef;
      --warning: #9a6700;
      --warning-bg: #fff8dc;
      --focus: #2f73d9;
      --shadow: 0 8px 24px rgba(43, 42, 36, 0.08);
      --shadow-card: 0 2px 8px rgba(43, 42, 36, 0.08);
      --radius: 14px;
      --radius-sm: 10px;
      --column-width: 330px;
    }

    * { box-sizing: border-box; }

    html, body { min-height: 100%; }

    body {
      margin: 0;
      font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      color: var(--text);
      background: var(--page);
      line-height: 1.45;
    }

    button, input, select, textarea { font: inherit; }

    button { cursor: pointer; }

    button:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible,
    [contenteditable="true"]:focus-visible {
      outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent);
      outline-offset: 2px;
    }

    .skip-link {
      position: fixed;
      left: 12px;
      top: -60px;
      z-index: 2000;
      padding: 10px 14px;
      border-radius: 8px;
      color: white;
      background: #111;
      transition: top 0.2s ease;
    }

    .skip-link:focus { top: 12px; }

    .app-shell {
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    .topbar {
      /* Keep the controls in the normal document flow so the entire page scrolls. */
      position: static;
      z-index: auto;
      padding: 18px 24px 12px;
      background: var(--page);
      border-bottom: 1px solid rgba(222, 221, 214, 0.8);
      backdrop-filter: none;
    }

    .title-row,
    .toolbar,
    .filter-row,
    .summary-row {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .title-row { justify-content: space-between; }

    .project-title {
      min-width: 220px;
      max-width: min(760px, 100%);
      margin: 0;
      padding: 2px 6px;
      border-radius: 8px;
      font-size: clamp(1.55rem, 3vw, 2.35rem);
      font-weight: 750;
      letter-spacing: -0.035em;
      line-height: 1.15;
    }

    .project-title:empty::before {
      content: "Untitled project";
      color: var(--muted);
    }

    .saved-status {
      min-width: 120px;
      color: var(--muted);
      font-size: 0.86rem;
      text-align: right;
    }

    .toolbar { margin-top: 14px; }

    .toolbar-group {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .toolbar-group.end { margin-left: auto; }

    .btn,
    .icon-btn {
      border: 1px solid var(--border-strong);
      color: var(--text);
      background: var(--surface);
      border-radius: 9px;
      min-height: 40px;
      padding: 8px 13px;
      font-weight: 650;
      box-shadow: 0 1px 1px rgba(0,0,0,0.03);
      transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
    }

    .btn:hover,
    .icon-btn:hover {
      background: #fbfbf9;
      border-color: #aaa89f;
    }

    .btn:active,
    .icon-btn:active { transform: translateY(1px); }

    .btn.primary {
      color: #fff;
      border-color: var(--primary);
      background: var(--primary);
    }

    .btn.primary:hover { background: var(--primary-dark); }

    .btn.danger {
      color: var(--danger);
      border-color: #e8b8b2;
      background: var(--danger-bg);
    }

    .btn.subtle { background: transparent; }

    .icon-btn {
      width: 36px;
      min-height: 34px;
      padding: 4px;
      display: inline-grid;
      place-items: center;
      font-weight: 700;
    }

    .search-row {
      margin-top: 10px;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: 8px;
      flex-wrap: wrap;
      width: 100%;
    }

    .search-wrap {
      position: relative;
      flex: 0 1 620px;
      width: min(620px, 100%);
      min-width: 220px;
      max-width: 620px;
    }

    .search-row-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
      margin-left: auto;
    }

    .search-wrap::before {
      content: "⌕";
      position: absolute;
      left: 12px;
      top: 50%;
      transform: translateY(-52%);
      color: var(--muted);
      font-size: 1.2rem;
      pointer-events: none;
    }

    .search-input,
    .control,
    .form-field input,
    .form-field select,
    .form-field textarea {
      width: 100%;
      border: 1px solid var(--border-strong);
      border-radius: 9px;
      color: var(--text);
      background: var(--surface);
    }

    .search-input {
      min-height: 42px;
      padding: 9px 12px 9px 38px;
    }

    .filter-row {
      margin-top: 12px;
      padding-top: 12px;
      border-top: 1px solid var(--border);
    }

    .filter-control {
      display: grid;
      gap: 4px;
    }

    .filter-control label,
    .filter-spacer-label {
      color: var(--muted);
      font-size: 0.74rem;
      font-weight: 700;
      letter-spacing: 0.025em;
      text-transform: uppercase;
    }

    .filter-action .btn {
      width: 100%;
      min-height: 38px;
    }

    .filter-spacer-label {
      visibility: hidden;
      user-select: none;
    }

    .control {
      min-width: 145px;
      min-height: 38px;
      padding: 7px 10px;
    }

    .summary-row {
      margin-top: 12px;
      color: var(--muted);
      font-size: 0.9rem;
    }

    .summary-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 5px 9px;
      border: 1px solid var(--border);
      border-radius: 999px;
      color: var(--muted);
      background: rgba(255,255,255,0.72);
      font: inherit;
    }

    button.summary-pill {
      cursor: pointer;
      transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
    }

    button.summary-pill:hover {
      border-color: var(--border-strong);
      background: #fff;
    }

    button.summary-pill:active { transform: translateY(1px); }
    .summary-pill strong { color: var(--text); }
    .summary-pill.overdue strong { color: var(--danger); }
    .summary-pill.completed strong { color: var(--primary-dark); }
    .summary-pill.overdue[aria-pressed="true"] {
      color: #7a1e17;
      border-color: #dcaaa4;
      background: var(--danger-bg);
      box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 12%, transparent);
    }
    .summary-pill.completed[aria-pressed="true"] {
      color: #144f42;
      border-color: #a9cabe;
      background: #eaf5f0;
      box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 12%, transparent);
    }

    .active-filter-note {
      margin-left: auto;
      color: var(--warning);
      font-weight: 650;
    }

    .board-region {
      flex: 0 0 auto;
      min-height: 0;
      padding: 22px 24px 34px;
      overflow: visible;
    }

    .board {
      /* Horizontal column scrolling is retained, while vertical scrolling belongs to the page. */
      height: auto;
      min-height: 430px;
      display: flex;
      align-items: flex-start;
      gap: 16px;
      overflow-x: auto;
      overflow-y: visible;
      padding: 2px 2px 16px;
      scroll-snap-type: x proximity;
      scrollbar-color: #bdbbb2 transparent;
    }

    .column {
      --accent: #7686a5;
      --column-bg: rgba(118, 134, 165, 0.08);
      position: relative;
      flex: 0 0 var(--column-width);
      width: var(--column-width);
      min-width: 280px;
      display: flex;
      flex-direction: column;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: var(--column-bg);
      box-shadow: 0 1px 1px rgba(0,0,0,0.02);
      overflow: visible;
      scroll-snap-align: start;
      transition: width 0.18s ease, flex-basis 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
    }

    .column::before {
      content: "";
      position: absolute;
      inset: 0 0 auto;
      height: 6px;
      background: var(--accent);
    }

    .column.dragging,
    .card.dragging {
      opacity: 0.5;
      transform: scale(0.985);
    }

    .column.drop-before { box-shadow: -5px 0 0 var(--focus), var(--shadow); }
    .column.drop-after { box-shadow: 5px 0 0 var(--focus), var(--shadow); }

    .column.collapsed {
      flex-basis: 72px;
      width: 72px;
      min-width: 72px;
    }

    .column-header {
      padding: 17px 14px 12px;
      display: flex;
      align-items: center;
      gap: 8px;
      border-bottom: 1px solid color-mix(in srgb, var(--accent) 14%, var(--border));
      background: rgba(255,255,255,0.55);
    }

    .drag-handle {
      border: 0;
      padding: 2px 3px;
      color: var(--muted);
      background: transparent;
      cursor: grab;
      font-size: 1rem;
      letter-spacing: -0.15em;
      user-select: none;
    }

    .drag-handle:active { cursor: grabbing; }

    .column-title {
      min-width: 0;
      flex: 1;
      font-size: 1rem;
      font-weight: 760;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .count-badge {
      min-width: 28px;
      padding: 2px 7px;
      border-radius: 999px;
      color: var(--text);
      background: rgba(255,255,255,0.9);
      border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
      text-align: center;
      font-size: 0.78rem;
      font-weight: 750;
    }

    .column-actions {
      display: flex;
      gap: 4px;
    }

    .column-actions .icon-btn {
      border-color: transparent;
      background: transparent;
      width: 30px;
      min-height: 30px;
      color: var(--muted);
      box-shadow: none;
    }

    .column-actions .icon-btn:hover { background: rgba(255,255,255,0.8); }

    .column.menu-open { z-index: 25; }

    .column-more {
      width: 34px !important;
      min-height: 34px !important;
      border: 1px solid var(--border-strong) !important;
      border-radius: 9px !important;
      background: rgba(255,255,255,0.8) !important;
      font-size: 1rem;
      letter-spacing: 0.03em;
    }

    .column-more:hover { background: #fff !important; }

    .column-options-popover {
      position: absolute;
      top: 55px;
      right: 10px;
      z-index: 40;
      width: min(260px, calc(100vw - 32px));
      padding: 14px;
      border: 1px solid var(--border);
      border-radius: 13px;
      background: #fff;
      box-shadow: 0 18px 48px rgba(43, 42, 36, 0.20);
    }

    .column-options-popover::before {
      content: "";
      position: absolute;
      top: -7px;
      right: 17px;
      width: 12px;
      height: 12px;
      border-left: 1px solid var(--border);
      border-top: 1px solid var(--border);
      background: #fff;
      transform: rotate(45deg);
    }

    .column-menu-section + .column-menu-section {
      margin-top: 13px;
      padding-top: 13px;
      border-top: 1px solid var(--border);
    }

    .column-menu-label {
      display: block;
      margin-bottom: 9px;
      color: var(--muted);
      font-size: 0.75rem;
      font-weight: 760;
      letter-spacing: 0.035em;
      text-transform: uppercase;
    }

    .column-color-grid {
      display: grid;
      grid-template-columns: repeat(6, 32px);
      gap: 9px;
    }

    .column-color-swatch {
      width: 32px;
      height: 32px;
      display: inline-grid;
      place-items: center;
      padding: 0;
      border: 2px solid transparent;
      border-radius: 50%;
      color: #fff;
      background: var(--swatch-color);
      box-shadow: inset 0 0 0 1px rgba(0,0,0,0.16);
      font-size: 0.9rem;
      font-weight: 850;
      line-height: 1;
    }

    .column-color-swatch:hover { transform: translateY(-1px); }
    .column-color-swatch[aria-checked="true"] {
      border-color: #fff;
      box-shadow: 0 0 0 2px var(--text), inset 0 0 0 1px rgba(0,0,0,0.18);
    }

    .column-custom-color {
      margin-top: 11px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .column-custom-color label {
      color: var(--text);
      font-size: 0.86rem;
      font-weight: 680;
    }

    .column-custom-color input[type="color"] {
      width: 48px;
      height: 34px;
      padding: 3px;
      border: 1px solid var(--border-strong);
      border-radius: 8px;
      background: #fff;
      cursor: pointer;
    }

    .column-menu-actions {
      display: grid;
      gap: 5px;
    }

    .column-menu-action {
      width: 100%;
      min-height: 36px;
      padding: 7px 9px;
      border: 0;
      border-radius: 8px;
      color: var(--text);
      background: transparent;
      text-align: left;
      font-weight: 620;
    }

    .column-menu-action:hover { background: var(--surface-muted); }
    .column-menu-action:disabled { opacity: 0.42; cursor: not-allowed; }
    .column-menu-action.danger-text { color: var(--danger); }

    .column-completed-toggle {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 9px;
      border-radius: 8px;
      font-size: 0.86rem;
      font-weight: 620;
    }

    .column-completed-toggle:hover { background: var(--surface-muted); }
    .column-completed-toggle input { width: 17px; height: 17px; accent-color: var(--primary); }

    .column-body {
      min-height: 100px;
      flex: 1;
      display: flex;
      flex-direction: column;
      overflow: visible;
      border-radius: 0 0 var(--radius) var(--radius);
    }

    .column.collapsed .column-header {
      height: 100%;
      padding: 16px 8px;
      flex-direction: column;
      border-bottom: 0;
    }

    .column.collapsed .drag-handle { order: -2; }

    .column.collapsed .column-title {
      writing-mode: vertical-rl;
      transform: rotate(180deg);
      flex: 1;
      max-height: 280px;
      white-space: nowrap;
    }

    .column.collapsed .column-body {
      display: none;
    }

    .column.collapsed .column-options-popover {
      top: 45px;
      right: 6px;
    }

    .cards-list {
      flex: 1;
      overflow-y: visible;
      padding: 12px;
      scrollbar-color: #c5c2b8 transparent;
    }

    .cards-list.drag-over {
      background: color-mix(in srgb, var(--accent) 10%, transparent);
    }

    .empty-state {
      margin: 18px 4px;
      padding: 18px 12px;
      border: 1px dashed color-mix(in srgb, var(--accent) 30%, var(--border));
      border-radius: 10px;
      color: var(--muted);
      background: rgba(255,255,255,0.42);
      text-align: center;
      font-size: 0.87rem;
    }

    .card {
      --card-bg: var(--surface);
      --card-color: transparent;
      position: relative;
      margin-bottom: 10px;
      padding: 13px 13px 11px;
      border: 1px solid rgba(209, 207, 197, 0.95);
      border-left: 4px solid var(--card-color);
      border-radius: var(--radius-sm);
      color: var(--text);
      background: var(--card-bg);
      box-shadow: var(--shadow-card);
      cursor: pointer;
      transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    }

    .card-drag-handle {
      flex: 0 0 auto;
      margin: 1px 1px 0 -3px;
      padding: 1px 4px;
      border-radius: 5px;
      color: var(--muted);
      cursor: grab;
      line-height: 1.2;
      letter-spacing: -0.15em;
      user-select: none;
    }

    .card-drag-handle:hover { background: rgba(0,0,0,0.055); }
    .card-drag-handle:active { cursor: grabbing; }
    .card-drag-handle[aria-disabled="true"] { cursor: not-allowed; opacity: 0.38; }

    .card:hover,
    .card:focus-visible {
      transform: translateY(-1px);
      box-shadow: 0 7px 18px rgba(43, 42, 36, 0.11);
      border-color: #c8c5ba;
    }

    .card.overdue {
      border-left-color: var(--danger);
      background: linear-gradient(90deg, var(--danger-bg), var(--card-bg) 23%);
    }

    .card.approaching {
      border-left-color: #d08b00;
      background: linear-gradient(90deg, var(--warning-bg), var(--card-bg) 23%);
    }

    .card.drop-target { border-top: 4px solid var(--focus); }

    .card-topline {
      display: flex;
      align-items: flex-start;
      gap: 8px;
    }

    .card-title {
      min-width: 0;
      flex: 1;
      font-size: 0.98rem;
      font-weight: 720;
      line-height: 1.35;
      overflow-wrap: anywhere;
    }

    .card-actions {
      display: flex;
      align-items: center;
      gap: 2px;
      opacity: 0;
      transition: opacity 0.12s ease;
    }

    .card:hover .card-actions,
    .card:focus-within .card-actions { opacity: 1; }

    .card-actions .icon-btn {
      width: 27px;
      min-height: 27px;
      border: 0;
      color: var(--muted);
      background: transparent;
      box-shadow: none;
    }

    .card-actions .icon-btn:hover { background: var(--surface-muted); }

    .card-description {
      margin: 7px 0 0;
      display: -webkit-box;
      overflow: hidden;
      color: var(--muted);
      font-size: 0.87rem;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 3;
    }

    .card-context-row {
      margin-top: 8px;
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }

    .card-parent-project {
      min-width: 0;
      flex: 1 1 auto;
      color: #4e4d47;
      font-size: 0.78rem;
      font-weight: 700;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .card-parent-project span { color: var(--muted); font-weight: 600; }

    .priority-badge {
      flex: 0 0 auto;
      min-width: 28px;
      padding: 3px 8px;
      border: 1px solid transparent;
      border-radius: 999px;
      font-size: 0.72rem;
      font-weight: 800;
      line-height: 1.2;
      text-align: center;
    }

    .card-priority-pinned {
      flex: 0 0 auto;
      margin-left: auto;
    }

    .priority-a { color: #7b1e18; background: #fde9e6; border-color: #efb7b1; }
    .priority-b { color: #6e4a05; background: #fff2ce; border-color: #e7c76d; }
    .priority-c { color: #235f3a; background: #e7f4eb; border-color: #acd2b8; }

    .tags {
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
      margin-top: 10px;
    }

    .tag {
      max-width: 100%;
      padding: 3px 7px;
      border: 1px solid #d9d7ce;
      border-radius: 999px;
      color: #56554f;
      background: #f5f4ef;
      font-size: 0.72rem;
      font-weight: 700;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .card-meta {
      margin-top: 11px;
      padding-top: 9px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      border-top: 1px solid #eeece5;
      color: var(--muted);
      font-size: 0.76rem;
    }

    .meta-group {
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 7px;
      flex-wrap: wrap;
    }

    .owner-chip {
      max-width: 125px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .due-chip {
      padding: 2px 6px;
      border-radius: 6px;
      background: #f3f2ed;
      white-space: nowrap;
    }

    .overdue .due-chip {
      color: var(--danger);
      background: var(--danger-bg);
      font-weight: 750;
    }

    .approaching .due-chip {
      color: var(--warning);
      background: var(--warning-bg);
      font-weight: 750;
    }

    .column-footer {
      padding: 10px 12px 12px;
      border-top: 1px solid color-mix(in srgb, var(--accent) 14%, var(--border));
      background: rgba(255,255,255,0.48);
    }

    .column-footer .btn {
      width: 100%;
      min-height: 36px;
      border-style: dashed;
      color: var(--muted);
      background: rgba(255,255,255,0.55);
    }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 1000;
      display: none;
      align-items: flex-start;
      justify-content: center;
      padding: 12px;
      overflow-y: auto;
      background: rgba(24, 24, 22, 0.48);
      backdrop-filter: blur(3px);
      overscroll-behavior: contain;
    }

    .modal-backdrop.open { display: flex; }

    /* The card editor can be opened from Calendar & Reminders. Keep it above
       the calendar so closing the card reveals the same calendar view. */
    #modalBackdrop { z-index: 1120; }

    .modal {
      width: min(760px, 100%);
      max-height: calc(100dvh - 24px);
      min-height: 0;
      margin: auto 0;
      display: flex;
      flex-direction: column;
      border: 1px solid var(--border);
      border-radius: 16px;
      background: var(--surface);
      box-shadow: 0 26px 70px rgba(0,0,0,0.24);
      overflow: hidden;
    }

    .modal form {
      min-height: 0;
      max-height: inherit;
      display: flex;
      flex-direction: column;
    }

    .modal-header {
      flex: 0 0 auto;
      padding: 18px 20px 14px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      border-bottom: 1px solid var(--border);
    }

    .modal-header h2 {
      margin: 0;
      font-size: 1.22rem;
      letter-spacing: -0.01em;
    }

    .modal-body {
      min-height: 0;
      padding: 18px 20px 28px;
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 16px;
      overflow-y: auto;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
    }

    .form-field {
      min-width: 0;
      display: grid;
      gap: 6px;
    }

    .form-field.full { grid-column: 1 / -1; }

    .form-field label {
      font-size: 0.84rem;
      font-weight: 720;
    }

    .form-field input,
    .form-field select,
    .form-field textarea {
      min-height: 42px;
      padding: 9px 11px;
    }

    .form-field textarea {
      min-height: 130px;
      resize: vertical;
    }

    .help-text {
      color: var(--muted);
      font-size: 0.78rem;
    }

    /* Searchable author and project pickers. These allow selecting an existing
       value while still accepting a newly typed value. */
    .multi-combobox,
    .single-combobox {
      position: relative;
      width: 100%;
      max-width: 100%;
      min-width: 0;
    }

    .multi-combobox-control,
    .single-combobox-control {
      width: 100%;
      max-width: 100%;
      min-width: 0;
      min-height: 42px;
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 5px 6px 5px 8px;
      border: 1px solid var(--border-strong);
      border-radius: 9px;
      background: var(--surface);
    }

    /* Author chips and the typing field share one wrapping flex line. The
       input therefore continues immediately after the last chip and only
       moves to a new line when the remaining width is too small. */
    .multi-combobox-control {
      position: relative;
      flex-wrap: wrap;
      align-content: center;
      padding-right: 46px;
    }

    .multi-combobox-control:focus-within,
    .single-combobox-control:focus-within {
      outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent);
      outline-offset: 2px;
      border-color: color-mix(in srgb, var(--focus) 55%, var(--border-strong));
    }

    .multi-combobox-chips {
      /* display: contents lets each chip participate directly in the parent
         flex layout, so the input sits beside the final chip instead of on a
         separate row. */
      display: contents;
    }

    .author-chip {
      min-width: 0;
      max-width: min(100%, 180px);
      flex: 0 1 auto;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 4px 5px 4px 8px;
      border: 1px solid #d7d5cc;
      border-radius: 999px;
      color: #45443f;
      background: #f1f0eb;
      font-size: 0.78rem;
      font-weight: 680;
    }

    .author-chip-name {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .author-chip-remove {
      width: 20px;
      height: 20px;
      display: inline-grid;
      place-items: center;
      padding: 0;
      border: 0;
      border-radius: 50%;
      color: var(--muted);
      background: transparent;
      font-size: 0.95rem;
      line-height: 1;
    }

    .author-chip-remove:hover { color: var(--danger); background: #fff; }

    .form-field .multi-combobox-input,
    .form-field .single-combobox-input {
      width: auto;
      max-width: 100%;
      min-width: 92px;
      min-height: 32px;
      flex: 1 1 120px;
      padding: 4px 5px;
      border: 0;
      border-radius: 6px;
      outline: 0;
      background: transparent;
      box-shadow: none;
    }

    .form-field .single-combobox-input { min-width: 0; }

    /* Keep the single-value project field and priority field on the exact same
       control height so their boxes align across the two-column form row. */
    .single-combobox-control,
    .priority-select-shell,
    .priority-select-shell select {
      height: 42px;
      min-height: 42px;
    }

    .priority-select-shell {
      position: relative;
      width: 100%;
      display: block;
      margin: 0;
      line-height: 0;
      vertical-align: top;
    }

    .form-field .priority-select-shell select {
      width: 100%;
      display: block;
      margin: 0;
      padding: 9px 50px 9px 11px;
      appearance: none;
      -webkit-appearance: none;
      background-image: none;
      line-height: 1.35;
      vertical-align: top;
    }

    /* Lock these neighboring fields to identical label/control/help rows. */
    .parent-project-field,
    .priority-field {
      grid-template-rows: auto 42px auto;
      align-content: start;
    }

    .parent-project-field .single-combobox,
    .priority-field .priority-select-shell {
      align-self: start;
    }

    .priority-select-chevron {
      position: absolute;
      top: 4px;
      right: 5px;
      width: 34px;
      height: 34px;
      display: inline-grid;
      place-items: center;
      border: 1px solid var(--border);
      border-radius: 9px;
      color: #5f5e58;
      background: #f7f6f2;
      pointer-events: none;
      transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
    }

    .priority-select-chevron::before {
      content: "";
      width: 8px;
      height: 8px;
      border-right: 2px solid currentColor;
      border-bottom: 2px solid currentColor;
      transform: translateY(-2px) rotate(45deg);
    }

    .priority-select-shell:hover .priority-select-chevron,
    .priority-select-shell:focus-within .priority-select-chevron {
      color: var(--text);
      border-color: var(--border-strong);
      background: #fff;
    }

    /* A compact rounded-square button with a CSS chevron is clearer and more
       consistent than the previous text glyph. */
    .combobox-toggle {
      flex: 0 0 34px;
      width: 34px;
      height: 34px;
      display: inline-grid;
      place-items: center;
      padding: 0;
      border: 1px solid var(--border);
      border-radius: 9px;
      color: #5f5e58;
      background: #f7f6f2;
      line-height: 1;
      transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
    }

    .multi-combobox-control > .combobox-toggle {
      position: absolute;
      top: 5px;
      right: 5px;
    }

    .combobox-toggle::before {
      content: "";
      width: 8px;
      height: 8px;
      border-right: 2px solid currentColor;
      border-bottom: 2px solid currentColor;
      transform: translateY(-2px) rotate(45deg);
    }

    .combobox-toggle:hover {
      color: var(--text);
      border-color: var(--border-strong);
      background: #fff;
    }

    .combobox-toggle:active { transform: translateY(1px); }

    .combobox-options {
      position: absolute;
      inset: calc(100% + 5px) 0 auto;
      z-index: 1200;
      max-height: 220px;
      overflow-y: auto;
      padding: 5px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: #fff;
      box-shadow: 0 14px 34px rgba(43, 42, 36, 0.18);
    }

    .combobox-options[hidden] { display: none; }

    .combobox-option,
    .combobox-empty-option {
      width: 100%;
      min-height: 36px;
      padding: 7px 9px;
      border: 0;
      border-radius: 7px;
      color: var(--text);
      background: transparent;
      text-align: left;
      font-size: 0.86rem;
    }

    .combobox-option:hover,
    .combobox-option:focus-visible { background: var(--surface-muted); }
    .combobox-option.add-new { color: var(--primary-dark); font-weight: 720; }
    .combobox-empty-option { color: var(--muted); cursor: default; }

    .card-links-panel {
      padding: 14px;
      border: 1px solid var(--border);
      border-radius: 11px;
      background: #fcfcfa;
    }

    .card-links-heading {
      margin-bottom: 10px;
      font-size: 0.86rem;
      font-weight: 760;
    }

    .card-links-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
    }

    .link-field { min-width: 0; display: grid; gap: 6px; }
    .link-field label { font-size: 0.8rem; font-weight: 700; }

    .link-input-row {
      min-width: 0;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 6px;
    }

    .link-open-btn {
      min-width: 58px;
      min-height: 42px;
      padding: 7px 10px;
    }

    .link-open-btn:disabled { opacity: 0.48; cursor: not-allowed; }

    .card-document-links {
      margin-top: 9px;
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .card-document-link {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 3px 8px;
      border: 1px solid #cfddd7;
      border-radius: 999px;
      color: var(--primary-dark);
      background: #eff7f3;
      font-size: 0.74rem;
      font-weight: 720;
      text-decoration: none;
    }

    .card-document-link:hover { border-color: #9dbfaf; background: #e5f2ec; }

    .subtasks-panel {
      padding: 14px;
      border: 1px solid var(--border);
      border-radius: 11px;
      background: #fcfcfa;
    }

    .subtasks-heading {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 10px;
    }

    .subtasks-title-wrap { display: grid; gap: 2px; }
    .subtasks-summary { color: var(--muted); font-size: 0.78rem; }
    .subtask-list { display: grid; gap: 8px; }

    .subtask-row {
      border: 1px solid var(--border);
      border-radius: 9px;
      background: #fff;
      overflow: hidden;
    }

    .subtask-display {
      min-height: 52px;
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      align-items: center;
      gap: 10px;
      padding: 10px 11px;
    }

    .subtask-display input[type="checkbox"] {
      width: 20px;
      height: 20px;
      accent-color: var(--primary);
    }

    .subtask-copy { min-width: 0; display: grid; gap: 3px; }
    .subtask-name { font-weight: 680; overflow-wrap: anywhere; }
    .subtask-row.completed .subtask-name { color: var(--muted); text-decoration: line-through; }
    .subtask-meta { color: var(--muted); font-size: 0.76rem; overflow-wrap: anywhere; }

    .subtask-editor {
      padding: 13px;
      display: grid;
      gap: 12px;
      background: #fff;
    }

    .subtask-title-line {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      align-items: center;
      gap: 9px;
    }

    .subtask-title-line .subtask-circle {
      width: 22px;
      height: 22px;
      border: 2px solid var(--border-strong);
      border-radius: 50%;
    }

    .subtask-editor-grid {
      display: grid;
      grid-template-columns: 106px minmax(0, 1fr);
      gap: 9px 12px;
      align-items: start;
    }

    .subtask-editor-label {
      padding-top: 7px;
      font-size: 0.86rem;
      font-weight: 700;
      line-height: 1.2;
      text-align: right;
      white-space: nowrap;
    }

    /* Subtask assignees use the same chip-based searchable picker as card
       authors, but in a slightly more compact form. */
    .subtask-assignee-combo .multi-combobox-control {
      min-height: 38px;
      padding-top: 3px;
      padding-bottom: 3px;
      padding-right: 42px;
    }

    .subtask-assignee-combo .multi-combobox-control > .combobox-toggle {
      top: 3px;
      right: 4px;
      width: 30px;
      height: 30px;
      flex-basis: 30px;
      border-radius: 8px;
    }

    .subtask-assignee-combo .author-chip {
      max-width: min(100%, 165px);
      padding: 3px 4px 3px 7px;
      font-size: 0.76rem;
    }

    .subtask-assignee-combo .author-chip-remove {
      width: 18px;
      height: 18px;
      font-size: 0.88rem;
    }

    .form-field .subtask-assignee-input {
      min-height: 28px;
      min-width: 86px;
      padding-block: 2px;
      font-size: 0.84rem;
    }

    .subtask-due-options {
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: nowrap;
    }

    .subtask-due-choice {
      min-height: 34px;
      display: inline-flex;
      align-items: center;
      gap: 5px;
      flex: 0 0 auto;
      padding: 5px 8px;
      border: 1px solid var(--border);
      border-radius: 8px;
      color: #4e4d47;
      background: #f8f7f3;
      font-size: 0.81rem;
      font-weight: 620;
      line-height: 1;
      white-space: nowrap;
      cursor: pointer;
    }

    .subtask-due-choice:hover { border-color: var(--border-strong); background: #fff; }
    .subtask-due-choice:has(input:checked) {
      color: var(--primary-dark);
      border-color: #9fc7ba;
      background: #edf7f2;
    }

    .subtask-due-choice input[type="radio"] {
      width: 15px;
      height: 15px;
      margin: 0;
      flex: 0 0 auto;
      accent-color: var(--primary);
    }

    .subtask-date-input {
      width: 154px;
      min-width: 145px;
      min-height: 34px;
      padding: 5px 8px;
      border: 1px solid var(--border-strong);
      border-radius: 8px;
      font-size: 0.82rem;
    }

    .subtask-editor-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
    .subtask-editor-actions .btn {
      min-height: 33px;
      padding: 5px 10px;
      border-radius: 8px;
      font-size: 0.82rem;
    }
    .empty-subtasks { color: var(--muted); font-size: 0.86rem; padding: 7px 2px; }
    .subtask-progress { white-space: nowrap; }

    .metadata-panel {
      grid-column: 1 / -1;
      padding: 11px 12px;
      border: 1px solid var(--border);
      border-radius: 9px;
      color: var(--muted);
      background: var(--surface-muted);
      font-size: 0.8rem;
    }

    .history-panel {
      padding: 14px;
      border: 1px solid var(--border);
      border-radius: 11px;
      background: #fcfcfa;
    }

    .history-heading {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 10px;
    }

    .history-heading label { display: block; }
    .history-help { color: var(--muted); font-size: 0.78rem; }
    .history-list { display: grid; gap: 8px; }

    .history-entry {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
      padding: 10px 11px;
      border: 1px solid var(--border);
      border-radius: 9px;
      background: #fff;
    }

    .history-entry.current { background: #f1f8f4; border-color: #b7d3c8; }
    .history-copy { min-width: 0; display: grid; gap: 3px; }
    .history-action { font-weight: 720; overflow-wrap: anywhere; }
    .history-meta { color: var(--muted); font-size: 0.75rem; }
    .history-summary { color: #55544e; font-size: 0.8rem; overflow-wrap: anywhere; }
    .history-entry .btn { min-height: 32px; padding: 5px 9px; font-size: 0.8rem; white-space: nowrap; }

    .directory-modal { width: min(1180px, 100%); }
    .directory-tabs {
      display: flex;
      gap: 6px;
      padding: 12px 20px 0;
      border-bottom: 1px solid var(--border);
      background: #faf9f5;
    }

    .directory-tab {
      min-height: 38px;
      padding: 8px 14px;
      border: 1px solid transparent;
      border-bottom: 0;
      border-radius: 9px 9px 0 0;
      color: var(--muted);
      background: transparent;
      font-weight: 720;
    }

    .directory-tab[aria-selected="true"] {
      color: var(--text);
      border-color: var(--border);
      background: #fff;
      transform: translateY(1px);
    }

    .directory-body {
      min-height: 0;
      padding: 18px 20px 24px;
      overflow-y: auto;
    }

    .directory-panel[hidden],
    .directory-add-form[hidden] { display: none !important; }

    .directory-panel-heading {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 14px;
    }

    .directory-intro {
      max-width: 760px;
      margin: 0;
      color: var(--muted);
      font-size: 0.86rem;
    }

    .directory-modal .directory-form {
      display: grid;
      flex: none;
      min-height: auto;
      max-height: none;
      gap: 10px;
      align-items: start;
      margin-bottom: 14px;
      padding: 13px;
      border: 1px solid var(--border);
      border-radius: 11px;
      background: #fafaf7;
    }

    .directory-form.person-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .directory-form.project-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .directory-form .full { grid-column: 1 / -1; }
    .directory-form .span-2 { grid-column: span 2; }
    .directory-form .span-3 { grid-column: span 3; }
    .directory-form .form-field { gap: 4px; min-width: 0; }
    .directory-form .form-field input,
    .directory-form .form-field select,
    .directory-form .form-field textarea {
      width: 100%;
      min-height: 38px;
      padding: 7px 9px;
    }

    .directory-form .form-field textarea {
      min-height: 78px;
      resize: vertical;
    }

    /* Project staff pickers reuse the author/subtask chip pattern while
       drawing their choices exclusively from the permanent People directory. */
    .directory-person-picker { min-width: 0; }

    .directory-person-picker .multi-combobox-control {
      min-height: 38px;
      padding-top: 3px;
      padding-bottom: 3px;
      padding-right: 42px;
    }

    .directory-person-picker .multi-combobox-control > .combobox-toggle {
      top: 3px;
      right: 4px;
      width: 30px;
      height: 30px;
      flex-basis: 30px;
      border-radius: 8px;
    }

    .directory-form .directory-person-picker .multi-combobox-input {
      width: auto;
      max-width: 100%;
      min-width: 86px;
      min-height: 28px;
      flex: 1 1 110px;
      padding: 3px 5px;
      border: 0;
      border-radius: 6px;
      outline: 0;
      background: transparent;
      box-shadow: none;
    }

    .directory-person-picker .author-chip {
      max-width: min(100%, 165px);
      padding: 3px 4px 3px 7px;
      font-size: 0.76rem;
    }

    .directory-person-picker .author-chip-remove {
      width: 18px;
      height: 18px;
      font-size: 0.88rem;
    }

    .directory-person-picker input[type="hidden"] { display: none; }

    .directory-form-actions {
      grid-column: 1 / -1;
      display: flex;
      justify-content: flex-end;
      gap: 6px;
      align-items: center;
    }

    .directory-form-actions .btn {
      min-height: 36px;
      padding: 6px 10px;
      white-space: nowrap;
    }

    .directory-form-note {
      grid-column: 1 / -1;
      margin-top: -2px;
      color: var(--muted);
      font-size: 0.76rem;
    }

    .directory-list { display: grid; gap: 10px; margin-top: 14px; }
    .directory-entry { display: grid; gap: 8px; min-width: 0; }

    .directory-item {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: center;
      padding: 11px 12px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: #fff;
    }

    .directory-item.project-directory-item { align-items: start; }
    .directory-item-copy { min-width: 0; display: grid; gap: 2px; }
    .directory-item-name { font-weight: 720; overflow-wrap: anywhere; }
    .directory-item-meta { color: var(--muted); font-size: 0.78rem; overflow-wrap: anywhere; }
    .directory-item-actions { display: flex; gap: 6px; align-items: center; }
    .directory-item-actions .btn { min-height: 32px; padding: 5px 9px; font-size: 0.8rem; }

    .inline-directory-form {
      margin: 0 0 2px 18px;
      border-left: 4px solid var(--primary);
      background: #f7fbf9;
      box-shadow: 0 5px 16px rgba(43, 42, 36, 0.06);
    }

    .project-directory-details {
      grid-column: 1 / -1;
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px 16px;
      margin-top: 4px;
      padding-top: 10px;
      border-top: 1px solid #eeece5;
    }

    .directory-detail { min-width: 0; display: grid; gap: 2px; }
    .directory-detail.full { grid-column: 1 / -1; }
    .directory-detail-label {
      color: var(--muted);
      font-size: 0.68rem;
      font-weight: 760;
      letter-spacing: 0.035em;
      text-transform: uppercase;
    }
    .directory-detail-value {
      color: #4f4e48;
      font-size: 0.8rem;
      overflow-wrap: anywhere;
      white-space: pre-wrap;
    }

    .project-status-badge {
      display: inline-flex;
      width: fit-content;
      padding: 2px 7px;
      border: 1px solid #d4d2c9;
      border-radius: 999px;
      color: #55544e;
      background: #f3f2ed;
      font-size: 0.72rem;
      font-weight: 750;
    }

    .directory-empty { padding: 24px 12px; color: var(--muted); text-align: center; }

    /* ============================================================
       TEAM DASHBOARD
       ============================================================ */
    .team-dashboard-modal { width: min(1240px, 100%); }

    .team-dashboard-toolbar {
      flex: 0 0 auto;
      padding: 12px 20px;
      display: flex;
      align-items: end;
      gap: 12px;
      flex-wrap: wrap;
      border-bottom: 1px solid var(--border);
      background: #faf9f5;
    }

    .team-dashboard-toolbar .filter-control { min-width: 190px; }
    .dashboard-updated {
      margin-left: auto;
      align-self: center;
      color: var(--muted);
      font-size: 0.8rem;
    }

    .team-dashboard-body {
      min-height: 0;
      padding: 18px 20px 28px;
      display: grid;
      gap: 18px;
      overflow-y: auto;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
    }

    .dashboard-metrics {
      display: grid;
      grid-template-columns: repeat(6, minmax(130px, 1fr));
      gap: 10px;
    }

    .dashboard-metric {
      min-width: 0;
      padding: 13px 14px;
      border: 1px solid var(--border);
      border-radius: 11px;
      background: #fff;
      box-shadow: 0 1px 2px rgba(43, 42, 36, 0.04);
    }

    .dashboard-metric-label {
      color: var(--muted);
      font-size: 0.7rem;
      font-weight: 760;
      letter-spacing: 0.035em;
      text-transform: uppercase;
    }

    .dashboard-metric-value {
      margin-top: 4px;
      font-size: 1.55rem;
      font-weight: 800;
      letter-spacing: -0.035em;
      line-height: 1.05;
    }

    .dashboard-metric-note { margin-top: 4px; color: var(--muted); font-size: 0.74rem; }
    .dashboard-metric.alert .dashboard-metric-value { color: var(--danger); }
    .dashboard-metric.warning .dashboard-metric-value { color: var(--warning); }
    .dashboard-metric.success .dashboard-metric-value { color: var(--primary-dark); }

    .dashboard-section {
      min-width: 0;
      padding: 14px;
      border: 1px solid var(--border);
      border-radius: 12px;
      background: #fff;
    }

    .dashboard-section-heading {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 11px;
    }

    .dashboard-section-title { margin: 0; font-size: 1rem; }
    .dashboard-section-note { margin: 2px 0 0; color: var(--muted); font-size: 0.78rem; }
    .dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
    .dashboard-attention-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

    .dashboard-table-wrap {
      max-width: 100%;
      overflow-x: auto;
      border: 1px solid #eceae3;
      border-radius: 9px;
    }

    .dashboard-table {
      width: 100%;
      min-width: 760px;
      border-collapse: collapse;
      font-size: 0.8rem;
    }

    .dashboard-table th,
    .dashboard-table td {
      padding: 9px 10px;
      border-bottom: 1px solid #eceae3;
      text-align: left;
      vertical-align: top;
    }

    .dashboard-table th {
      color: var(--muted);
      background: #faf9f5;
      font-size: 0.68rem;
      font-weight: 800;
      letter-spacing: 0.035em;
      text-transform: uppercase;
      white-space: nowrap;
    }

    .dashboard-table tr:last-child td { border-bottom: 0; }
    .dashboard-table tbody tr:hover { background: #fcfcfa; }
    .dashboard-person-name,
    .dashboard-project-name { font-weight: 720; }
    .dashboard-person-role,
    .dashboard-project-status { margin-top: 2px; color: var(--muted); font-size: 0.74rem; }
    .dashboard-number { font-variant-numeric: tabular-nums; white-space: nowrap; }
    .dashboard-number.alert { color: var(--danger); font-weight: 760; }
    .dashboard-number.warning { color: var(--warning); font-weight: 760; }

    .dashboard-action-btn {
      min-height: 30px;
      padding: 4px 8px;
      border: 1px solid var(--border-strong);
      border-radius: 7px;
      color: var(--primary-dark);
      background: #fff;
      font-size: 0.75rem;
      font-weight: 720;
      white-space: nowrap;
    }

    .dashboard-action-btn:hover { background: #f2f7f4; border-color: #a9cabe; }
    .dashboard-action-btn:disabled { opacity: 0.45; cursor: not-allowed; }

    .dashboard-attention-card {
      min-width: 0;
      padding: 12px;
      border: 1px solid #eceae3;
      border-radius: 10px;
      background: #fafaf7;
    }

    .dashboard-attention-title { margin: 0 0 8px; font-size: 0.88rem; }
    .dashboard-list { display: grid; gap: 7px; }

    .dashboard-list-row {
      min-width: 0;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      gap: 9px;
      padding: 8px 9px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #fff;
    }

    .dashboard-list-copy { min-width: 0; display: grid; gap: 2px; }
    .dashboard-list-name { font-size: 0.8rem; font-weight: 690; overflow-wrap: anywhere; }
    .dashboard-list-meta { color: var(--muted); font-size: 0.72rem; overflow-wrap: anywhere; }
    .dashboard-empty { padding: 14px 8px; color: var(--muted); font-size: 0.8rem; text-align: center; }

    .pipeline-list { display: grid; gap: 9px; }
    .pipeline-row { display: grid; grid-template-columns: minmax(120px, 0.9fr) minmax(150px, 2fr) auto; gap: 10px; align-items: center; }
    .pipeline-label { min-width: 0; font-size: 0.8rem; font-weight: 690; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .pipeline-track { height: 9px; overflow: hidden; border-radius: 999px; background: #eceae3; }
    .pipeline-fill { width: var(--pipeline-width); height: 100%; border-radius: inherit; background: var(--pipeline-color); }
    .pipeline-count { color: var(--muted); font-size: 0.76rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

    @media (max-width: 1050px) {
      .dashboard-metrics { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
      .dashboard-grid { grid-template-columns: 1fr; }
    }

    @media (max-width: 700px) {
      .dashboard-metrics { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
      .dashboard-attention-grid { grid-template-columns: 1fr; }
      .dashboard-updated { width: 100%; margin-left: 0; }
      .pipeline-row { grid-template-columns: minmax(100px, 0.8fr) minmax(100px, 1.4fr) auto; }
    }

    @media (max-width: 430px) {
      .dashboard-metrics { grid-template-columns: 1fr; }
      .team-dashboard-body { padding-inline: 12px; }
    }

    .modal-footer {
      flex: 0 0 auto;
      padding: 14px 20px;
      display: flex;
      align-items: center;
      gap: 9px;
      border-top: 1px solid var(--border);
      background: #fbfbf9;
    }

    .modal-footer .spacer { flex: 1; }

    .toast {
      position: fixed;
      right: 18px;
      bottom: 18px;
      z-index: 1500;
      max-width: min(420px, calc(100vw - 36px));
      padding: 11px 14px;
      border: 1px solid #b6c8bf;
      border-radius: 9px;
      color: #133e34;
      background: #eaf5f0;
      box-shadow: var(--shadow);
      opacity: 0;
      transform: translateY(10px);
      pointer-events: none;
      transition: opacity 0.18s ease, transform 0.18s ease;
    }

    .toast.show {
      opacity: 1;
      transform: translateY(0);
    }

    .subtasks-view-modal {
      width: min(1040px, 100%);
    }

    .subtasks-view-toolbar {
      flex: 0 0 auto;
      padding: 14px 20px;
      display: flex;
      align-items: end;
      gap: 10px;
      flex-wrap: wrap;
      border-bottom: 1px solid var(--border);
      background: #faf9f5;
    }

    .subtasks-view-toolbar .filter-control {
      min-width: 190px;
      flex: 0 1 260px;
    }

    .subtasks-view-count {
      margin-left: auto;
      align-self: center;
      color: var(--muted);
      font-size: 0.86rem;
      font-weight: 650;
    }

    .all-subtasks-list {
      min-height: 0;
      padding: 16px 20px 24px;
      display: grid;
      gap: 10px;
      flex: 1 1 auto;
      overflow-y: auto;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
    }

    .all-subtask-row {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      align-items: start;
      gap: 12px;
      padding: 13px 14px;
      border: 1px solid var(--border);
      border-radius: 11px;
      background: #fff;
    }

    .all-subtask-row.completed { background: #f6f7f3; }

    .all-subtask-check {
      width: 19px;
      height: 19px;
      margin-top: 2px;
      accent-color: var(--primary);
    }

    .all-subtask-copy {
      min-width: 0;
      display: grid;
      gap: 5px;
    }

    .all-subtask-title {
      font-weight: 720;
      overflow-wrap: anywhere;
    }

    .all-subtask-row.completed .all-subtask-title {
      color: var(--muted);
      text-decoration: line-through;
    }

    .all-subtask-meta,
    .all-subtask-assignees {
      display: flex;
      align-items: center;
      gap: 7px;
      flex-wrap: wrap;
      color: var(--muted);
      font-size: 0.78rem;
    }

    .all-subtask-card-link {
      padding: 0;
      border: 0;
      color: var(--primary-dark);
      background: transparent;
      font: inherit;
      font-weight: 700;
      text-align: left;
      text-decoration: underline;
      cursor: pointer;
    }

    .all-subtask-due {
      white-space: nowrap;
      padding: 3px 7px;
      border-radius: 999px;
      color: #55544e;
      background: #f1f0ea;
      font-size: 0.75rem;
      font-weight: 700;
    }

    .all-subtask-due.overdue { color: #861f18; background: #fde8e5; }
    .all-subtask-due.today { color: #745006; background: #fff0c2; }

    .empty-subtasks-view {
      padding: 36px 18px;
      border: 1px dashed var(--border-strong);
      border-radius: 12px;
      color: var(--muted);
      text-align: center;
      background: #fafaf7;
    }

    .toast.error {
      color: #6b1711;
      border-color: #e0aaa4;
      background: #fff0ee;
    }

    .visually-hidden {
      position: absolute !important;
      width: 1px !important;
      height: 1px !important;
      padding: 0 !important;
      margin: -1px !important;
      overflow: hidden !important;
      clip: rect(0, 0, 0, 0) !important;
      white-space: nowrap !important;
      border: 0 !important;
    }


    /* Calendar and reminders */
    .reminder-toolbar-btn {
      display: inline-flex;
      align-items: center;
      gap: 7px;
    }

    .reminder-badge {
      min-width: 22px;
      padding: 1px 6px;
      border-radius: 999px;
      color: #fff;
      background: var(--danger);
      font-size: 0.72rem;
      font-weight: 800;
      line-height: 1.45;
      text-align: center;
    }

    .calendar-modal { width: min(1180px, 100%); }

    .calendar-toolbar {
      flex: 0 0 auto;
      padding: 13px 20px;
      display: flex;
      align-items: end;
      gap: 10px;
      flex-wrap: wrap;
      border-bottom: 1px solid var(--border);
      background: #faf9f5;
    }

    .calendar-nav {
      display: flex;
      align-items: center;
      gap: 7px;
      margin-right: 4px;
    }

    .calendar-month-title {
      min-width: 170px;
      margin: 0 4px;
      font-size: 1.02rem;
      font-weight: 780;
      text-align: center;
    }

    .calendar-toolbar .filter-control {
      min-width: 155px;
      flex: 0 1 210px;
    }

    .calendar-layout {
      min-height: 0;
      flex: 1 1 auto;
      display: grid;
      grid-template-columns: minmax(0, 1.7fr) minmax(315px, 0.75fr);
      overflow: hidden;
    }

    .calendar-main {
      min-width: 0;
      padding: 16px 18px 22px;
      overflow: auto;
      scrollbar-gutter: stable;
    }

    .calendar-weekdays,
    .calendar-grid {
      display: grid;
      grid-template-columns: repeat(7, minmax(105px, 1fr));
    }

    .calendar-weekdays {
      position: sticky;
      top: 0;
      z-index: 3;
      border: 1px solid var(--border);
      border-bottom: 0;
      border-radius: 10px 10px 0 0;
      overflow: hidden;
      background: #f5f4ef;
    }

    .calendar-weekday {
      padding: 7px 8px;
      color: var(--muted);
      border-right: 1px solid var(--border);
      font-size: 0.73rem;
      font-weight: 760;
      letter-spacing: 0.03em;
      text-align: center;
      text-transform: uppercase;
    }

    .calendar-weekday:last-child { border-right: 0; }

    .calendar-grid {
      border-top: 1px solid var(--border);
      border-left: 1px solid var(--border);
      background: #fff;
    }

    .calendar-day {
      min-height: 118px;
      padding: 7px;
      border-right: 1px solid var(--border);
      border-bottom: 1px solid var(--border);
      background: #fff;
    }

    .calendar-day.outside-month { background: #fafaf7; }
    .calendar-day.today { box-shadow: inset 0 0 0 2px var(--primary); }

    .calendar-date-number {
      width: 27px;
      height: 27px;
      display: inline-grid;
      place-items: center;
      margin-bottom: 5px;
      border-radius: 50%;
      color: var(--text);
      font-size: 0.78rem;
      font-weight: 760;
    }

    .calendar-day.outside-month .calendar-date-number { color: #aaa79e; }
    .calendar-day.today .calendar-date-number { color: #fff; background: var(--primary); }

    .calendar-events { display: grid; gap: 4px; }

    .calendar-event {
      width: 100%;
      min-width: 0;
      padding: 4px 6px;
      border: 1px solid #cbd8e5;
      border-radius: 6px;
      color: #23465f;
      background: #edf5fb;
      font-size: 0.72rem;
      font-weight: 680;
      line-height: 1.25;
      text-align: left;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .calendar-event.subtask {
      color: #225647;
      border-color: #bed9cf;
      background: #ebf6f1;
    }

    .calendar-event.overdue {
      color: #7b211a;
      border-color: #e3b1ab;
      background: #fff0ee;
    }

    .calendar-event.completed {
      color: var(--muted);
      border-color: var(--border);
      background: #f2f2ee;
      text-decoration: line-through;
    }

    .calendar-more {
      padding: 2px 3px;
      color: var(--muted);
      font-size: 0.71rem;
      font-weight: 700;
    }

    .reminders-panel {
      min-width: 0;
      padding: 17px;
      display: flex;
      flex-direction: column;
      gap: 14px;
      border-left: 1px solid var(--border);
      background: #fbfbf8;
      overflow-y: auto;
      scrollbar-gutter: stable;
    }

    .reminders-heading {
      display: flex;
      align-items: start;
      justify-content: space-between;
      gap: 10px;
    }

    .reminders-heading h3 { margin: 0; font-size: 1.02rem; }
    .reminders-heading p { margin: 3px 0 0; color: var(--muted); font-size: 0.78rem; }

    .reminder-settings {
      padding: 12px;
      display: grid;
      gap: 10px;
      border: 1px solid var(--border);
      border-radius: 11px;
      background: #fff;
    }

    .reminder-settings-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: end;
      gap: 8px;
    }

    .reminder-settings-row .filter-control { min-width: 0; }
    .reminder-actions { display: flex; gap: 7px; flex-wrap: wrap; }
    .reminder-actions .btn { min-height: 34px; padding: 6px 9px; font-size: 0.78rem; }
    .reminder-status { color: var(--muted); font-size: 0.75rem; line-height: 1.4; }

    .reminder-list { display: grid; gap: 8px; }

    .reminder-item {
      padding: 10px;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 8px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: #fff;
    }

    .reminder-item.overdue { border-color: #e2aaa4; background: #fff5f3; }
    .reminder-item-copy { min-width: 0; display: grid; gap: 3px; }
    .reminder-item-title { font-size: 0.84rem; font-weight: 730; overflow-wrap: anywhere; }
    .reminder-item-meta { color: var(--muted); font-size: 0.73rem; line-height: 1.35; overflow-wrap: anywhere; }
    .reminder-item-due { font-size: 0.74rem; font-weight: 760; }
    .reminder-item.overdue .reminder-item-due { color: var(--danger); }
    .reminder-item-actions { display: flex; flex-direction: column; gap: 5px; align-items: stretch; }
    .reminder-item-actions .btn { min-height: 29px; padding: 4px 7px; font-size: 0.72rem; white-space: nowrap; }

    .reminder-empty {
      padding: 24px 12px;
      border: 1px dashed var(--border-strong);
      border-radius: 10px;
      color: var(--muted);
      background: #fff;
      text-align: center;
      font-size: 0.82rem;
    }

    @media (max-width: 900px) {
      .calendar-layout { grid-template-columns: 1fr; overflow: visible; }
      .calendar-main { overflow: auto; }
      .reminders-panel { border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
    }

    @media (max-width: 640px) {
      .calendar-toolbar .filter-control { flex: 1 1 135px; min-width: 0; }
      .calendar-nav { width: 100%; justify-content: space-between; }
      .calendar-month-title { min-width: 0; flex: 1; }
      .calendar-weekdays, .calendar-grid { grid-template-columns: repeat(7, minmax(82px, 1fr)); }
      .calendar-day { min-height: 105px; }
      .reminder-settings-row { grid-template-columns: 1fr; }
      .reminder-item { grid-template-columns: 1fr; }
      .reminder-item-actions { flex-direction: row; }
    }

    @media (max-width: 900px) {
      .topbar { padding-inline: 16px; }
      .board-region { padding-inline: 16px; }
      .active-filter-note { width: 100%; margin-left: 0; }
      .board { height: auto; }
    }

    @media (max-width: 640px) {
      :root { --column-width: min(88vw, 340px); }
      .topbar { position: static; }
      .saved-status { width: 100%; text-align: left; }
      .toolbar { align-items: stretch; }
      .toolbar-group { width: 100%; }
      .toolbar-group .btn { flex: 1 1 auto; }
      .search-wrap { flex-basis: 100%; width: 100%; max-width: none; }
      .search-row-actions { width: 100%; }
      .search-row-actions .btn { flex: 1 1 auto; }
      .filter-control { flex: 1 1 140px; }
      .control { min-width: 0; }
      .board-region { padding-top: 16px; }
      .board { height: auto; min-height: 0; }
      .modal-body { grid-template-columns: 1fr; }
      .form-field.full,
      .metadata-panel { grid-column: 1; }
      .modal-footer { flex-wrap: wrap; }
      .modal-footer .spacer { display: none; }
      .modal-footer .btn { flex: 1 1 40%; }
      .subtask-editor-grid { grid-template-columns: 1fr; gap: 6px; }
      .subtask-editor-label { padding-top: 0; text-align: left; }
      .subtask-due-options { flex-wrap: wrap; }
      .subtasks-view-toolbar .filter-control { min-width: 0; flex: 1 1 150px; }
      .subtasks-view-count { width: 100%; margin-left: 0; }
      .all-subtask-row { grid-template-columns: auto minmax(0, 1fr); }
      .all-subtask-row > .btn { grid-column: 2; justify-self: start; }
      .card-links-grid { grid-template-columns: 1fr; }
    }

    @media (max-width: 940px) {
      .directory-form.project-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .directory-form.project-form .span-3 { grid-column: span 1; }
      .project-directory-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }

    @media (max-width: 760px) {
      .directory-panel-heading { align-items: stretch; flex-direction: column; }
      .directory-panel-heading .btn { align-self: flex-start; }
      .directory-form.person-form,
      .directory-form.project-form { grid-template-columns: 1fr; }
      .directory-form .span-2,
      .directory-form .span-3,
      .directory-form .full { grid-column: 1; }
      .directory-form-actions { justify-content: flex-start; }
      .inline-directory-form { margin-left: 0; }
      .project-directory-details { grid-template-columns: 1fr; }
      .directory-detail.full { grid-column: 1; }
      .history-entry { grid-template-columns: 1fr; }
      .history-entry .btn { justify-self: start; }
    }

    @media (max-height: 620px) {
      .modal-backdrop { padding: 6px; }
      .modal { max-height: calc(100dvh - 12px); border-radius: 12px; }
      .modal-header { padding-block: 11px; }
      .modal-body { padding-block: 12px 20px; }
      .modal-footer { padding-block: 10px; }
    }

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

/* Collaboration additions */

[hidden] { display: none !important; }
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(145deg, #f7f6f2 0%, #ecefe9 100%);
}
.auth-card {
  width: min(460px, 100%);
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(43, 42, 36, 0.14);
}
.auth-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 13px;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
}
.auth-card h1 { margin: 0 0 8px; font-size: 1.6rem; }
.auth-copy, .modal-subtitle { margin: 0; color: var(--muted); }
.auth-form { margin-top: 22px; display: grid; gap: 10px; }
.auth-form label { font-weight: 720; }
.auth-form input {
  min-height: 44px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface);
}
.auth-actions { margin-top: 22px; }
.google-sign-in {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border-color: var(--border-strong);
  background: #fff;
}
.google-sign-in:hover { background: #f8f9fa; }
.google-sign-in svg { width: 20px; height: 20px; flex: 0 0 auto; }
.auth-status { min-height: 24px; margin-top: 12px; color: var(--muted); font-size: .88rem; }
.auth-status.error { color: var(--danger); }
.collaboration-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}
.btn.compact { min-height: 32px; padding: 5px 9px; font-size: .8rem; }
.current-user-display { color: var(--muted); font-size: .82rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.72);
  font-size: .76rem;
  font-weight: 720;
}
.connection-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #9b9b95; }
.connection-status[data-status="connected"]::before,
.connection-status[data-status="saved"]::before { background: #2f8f66; }
.connection-status[data-status="saving"]::before,
.connection-status[data-status="reconnecting"]::before { background: #d08b00; }
.connection-status[data-status="offline"]::before,
.connection-status[data-status="failed"]::before { background: var(--danger); }
.collaboration-modal { width: min(760px, 100%); }
.small-modal { width: min(520px, 100%); }
.migration-modal { width: min(700px, 100%); }
.collaboration-modal-body { min-height: 0; overflow-y: auto; padding: 20px; }
.member-add-form { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; align-items: end; gap: 10px; }
.members-list { display: grid; gap: 8px; margin-top: 18px; }
.member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.member-name { font-weight: 720; }
.member-email { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.member-role-label { padding: 4px 8px; border-radius: 999px; background: var(--surface-muted); font-size: .76rem; font-weight: 760; text-transform: capitalize; }
.conflict-actions, .migration-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.migration-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.migration-count { padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-muted); text-align: center; }
.migration-count strong { display: block; font-size: 1.25rem; }
.confirmation-check { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0; }
.offline-draft-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 1800;
  transform: translateX(-50%);
  width: min(680px, calc(100vw - 32px));
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #e3b1ab;
  border-radius: 10px;
  color: #711c15;
  background: #fff0ee;
  box-shadow: var(--shadow);
  font-size: .86rem;
}
.viewer-mode .requires-edit,
.viewer-mode #addCardBtn,
.viewer-mode #addColumnBtn,
.viewer-mode #importBtn,
.viewer-mode #resetBtn,
.viewer-mode .add-card-footer,
.viewer-mode .column-footer { display: none !important; }
.viewer-mode [contenteditable="true"] { pointer-events: none; }
.remote-change-note { color: var(--primary-dark); font-size: .76rem; font-weight: 700; }
@media (max-width: 760px) {
  .title-row { align-items: flex-start; }
  .collaboration-controls { width: 100%; justify-content: flex-start; }
  .member-add-form, .member-row { grid-template-columns: 1fr; }
  .migration-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
