* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #37352f;
  background: #ffffff;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
h1 { font-weight: 600; }

/* ------------------------------------------------------------------ login */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: #f7f7f5;
}
.login-card {
  background: #fff; border: 1px solid #e9e9e7; border-radius: 8px;
  padding: 32px; width: 320px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 1px 3px rgba(15, 15, 15, .1);
}
.login-card h1 { margin: 0 0 8px; font-size: 20px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #787774; }
.login-card input {
  padding: 8px 10px; border: 1px solid #e0e0de; border-radius: 6px; font-size: 14px;
}
.login-card button {
  cursor: pointer; border: 1px solid #2f6feb; background: #2f6feb; color: #fff;
  border-radius: 6px; padding: 9px 14px; font-size: 14px;
}
.login-card .login-check { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: #5f5e5b; }
.login-card .login-check input { margin: 0; }
.login-hint { color: #b0afab; }
.login-alt { margin: 0; font-size: 13px; color: #787774; text-align: center; }
.login-alt a { color: #2f6feb; }
.login-card form { display: flex; flex-direction: column; }
.login-button {
  display: block; text-align: center; border: 1px solid #2f6feb; background: #2f6feb; color: #fff;
  border-radius: 6px; padding: 9px 14px; font-size: 14px;
}
.invite-text { margin: 0; font-size: 14px; color: #37352f; }
.invite-text.muted { padding: 0; }
.invite-name { margin: -6px 0 4px; font-size: 18px; font-weight: 600; }
.login-banner {
  margin: 0; padding: 8px 10px; border-radius: 6px; background: #eef2fb; color: #37352f; font-size: 13px;
}

/* Workspace settings: members and invites */
.ws-list { list-style: none; padding: 0; margin: 0; }
.ws-list li {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid #f0f0ee;
}
.ws-list li:last-child { border-bottom: 0; }
.ws-list .ws-who { display: flex; flex-direction: column; min-width: 0; }
.ws-list .ws-who small { color: #9b9a97; }
.ws-list form { margin-left: auto; }
.ws-list .admin-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.ws-list .admin-actions form { margin-left: 0; }
.account-required { border-color: #f0c36d; box-shadow: 0 0 0 3px #fdf3dc; }
.conflict {
  border: 1px solid #f0c36d; background: #fffaf0; border-radius: 8px; padding: 12px 14px;
  margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px;
}
.conflict p { margin: 0; color: #5f5e5b; }
.conflict-current {
  background: #fff; border: 1px solid #ecece9; border-radius: 6px; padding: 10px 12px;
  max-height: 320px; overflow: auto;
}
.conflict-title { font-weight: 600; margin-bottom: 4px; }
.conflict-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: #787774; margin-bottom: 6px; }
.conflict-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.flash.provisional { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.provisional-password {
  font-size: 15px; padding: 2px 8px; background: #fff; border: 1px solid #e0e0de; border-radius: 6px;
  letter-spacing: .05em;
}
.ws-list .btn { padding: 3px 10px; font-size: 12px; }
.invite-link {
  flex: 1 1 220px; min-width: 0; padding: 5px 8px; border: 1px solid #e0e0de; border-radius: 6px;
  font-size: 12px; color: #5f5e5b; background: #fbfbfa;
}

/* Workspace settings: note by e-mail */
.mail-rules { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.mail-copy { padding: 1px 8px; font-size: 12px; vertical-align: baseline; }
.mail-form { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid #f0f0ee; }
.mail-form h3 { font-size: 13px; margin: 0; }
.account-card code { overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- account */
.account { max-width: 480px; }
/* Workspace settings has longer texts (addresses, invite links). */
.account-wide { max-width: 760px; }
.account h1 { font-size: 22px; margin: 8px 0 2px; }
.account-email { padding: 0; margin: 0 0 16px; }
.account-card {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; margin-bottom: 14px;
  border: 1px solid #e9e9e7; border-radius: 8px;
}
.account-card h2 { font-size: 14px; margin: 0; }
.account-field { display: flex; flex-direction: column; gap: 4px; }
.account-field input {
  padding: 7px 10px; border: 1px solid #e9e9e7; border-radius: 8px; font-size: 14px; font-family: inherit;
}
.user-link { color: #5f5e5b; }

/* ----------------------------------------------------------------- layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: #fbfbfa; border-right: 1px solid #ecece9;
  padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { font-weight: 700; font-size: 15px; padding: 4px 8px 12px; }
.section { margin-bottom: 18px; }
.section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: #9b9a97; padding: 4px 8px; font-weight: 600;
}
.nav-link { display: block; padding: 6px 8px; border-radius: 6px; color: #5f5e5b; }
.nav-link:hover { background: #efefee; }
.nav-link.active { background: #eaeaf7; color: #37352f; font-weight: 600; }
.nav-link.accent { color: #2f6feb; font-weight: 600; }
/* Sidebar boards: drag a row, or ▲ to move it up (on hover; always shown on touch). */
.board-row { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.board-row .nav-link { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row.dragging { opacity: .4; background: #eaeaf7; }
.board-step {
  visibility: hidden; flex: none; border: none; background: none; cursor: pointer;
  color: #9b9a97; font-size: 10px; padding: 4px 5px; border-radius: 4px; line-height: 1;
}
.board-row:hover .board-step, .board-step:focus-visible { visibility: visible; }
.board-step:hover { background: #e4e4e2; color: #37352f; }
.board-step:disabled { opacity: .3; cursor: default; background: none; }
@media (hover: none) {
  .board-step { visibility: visible; font-size: 12px; padding: 8px 7px; }
}
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 8px; }
.tag { font-size: 12px; background: #efefee; padding: 2px 8px; border-radius: 10px; color: #5f5e5b; }
.tag:hover { background: #e4e4e2; }
.muted { color: #9b9a97; padding: 4px 8px; font-size: 12px; }

/* Workspace switcher (sidebar) */
.ws-switch details summary {
  cursor: pointer; padding: 6px 8px; border-radius: 6px; font-weight: 600; color: #37352f;
}
.ws-switch details summary:hover { background: #efefee; }
.ws-switch details[open] summary { margin-bottom: 2px; }
.ws-switch details .nav-link { padding-left: 18px; }
.ws-index li { justify-content: flex-start; align-items: center; }
.ws-shared { display: inline-flex; vertical-align: -2px; margin-left: 6px; color: #2f6feb; }
.ws-shared svg {
  width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.ws-index .note-index-tags { margin-left: auto; }
.ws-edit { padding: 2px 6px; border-radius: 6px; color: #9b9a97; font-size: 15px; }
.ws-edit:hover { background: #efefee; color: #37352f; }
.ws-back { display: inline-block; padding: 0; }
.sidebar-divider { border: 0; border-top: 1px solid #e4e4e2; margin: 0 8px 14px; }
.ws-note { padding: 0; margin: 0; }
.ws-index { margin: 0; }

.content { flex: 1; min-width: 0; padding: 0 28px 40px; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 16px 0;
  position: sticky; top: 0; background: #fff; z-index: 5;
}
.search { flex: 1; }
.search input, .search-input {
  width: 100%; max-width: 420px; padding: 8px 12px; border: 1px solid #e9e9e7;
  border-radius: 8px; font-size: 14px; background: #f7f7f5;
}
.logout { color: #9b9a97; font-size: 13px; }
.logout:hover { color: #37352f; }

.flash {
  background: #f1f7ff; border: 1px solid #d6e6ff; color: #1a4b8f;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px;
}
.flash.warn { background: #fff7ed; border-color: #fde4c8; color: #9a5b1a; }

.board-head { display: flex; align-items: baseline; gap: 16px; margin: 8px 0 16px; }
.board-head h1 { font-size: 22px; margin: 0; }
/* The "+ Board" panel: chips like the filter panels; Excluir is a <button>. */
.board-actions button.chip { background: #fff; font-family: inherit; line-height: inherit; cursor: pointer; }
.board-actions .chip.danger { color: #b3261e; border-color: #ecc7c5; }
.board-actions .chip.danger:hover { background: #fdf3f2; }

.btn {
  cursor: pointer; border: 1px solid #e0e0de; background: #fff; border-radius: 6px;
  padding: 7px 13px; font-size: 13px; color: #37352f;
  display: inline-block; text-decoration: none; font-family: inherit;
}
.btn:hover { background: #f4f4f2; }
.btn[hidden] { display: none; }
.btn.primary { background: #2f6feb; color: #fff; border-color: #2f6feb; }
.btn.danger { color: #b3261e; border-color: #ecc7c5; }

/* --------------------------------------------------------- global filter */
.global-filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 18px; }
.gf-label { font-size: 12px; color: #9b9a97; }
.chip {
  font-size: 12px; padding: 3px 10px; border-radius: 12px; border: 1px solid #e9e9e7; color: #5f5e5b;
}
.chip:hover { background: #f4f4f2; }
.chip.on { background: #2f6feb; color: #fff; border-color: #2f6feb; }
.board-scope { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.chip.scope { background: #eef2fb; border-color: #cddbf5; color: #2f6feb; cursor: default; }

/* ---------------------------------------------------------------- kanban */
.kanban-wrap { overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.kanban-wrap::-webkit-scrollbar { display: none; }  /* replaced by .kanban-scrollbar */
/* Mirror of the board's scrollbar, stuck to the bottom of the screen
   (static/js/board_scroll.js). Thin and grey; darker on hover. */
.kanban-scrollbar {
  position: sticky; bottom: 0; overflow-x: auto; overflow-y: hidden; height: 12px;
  background: rgba(251, 251, 250, .9); scrollbar-width: thin; scrollbar-color: #d3d2cf transparent;
}
.kanban-scrollbar:hover { scrollbar-color: #a9a8a5 transparent; }
.kanban-scrollbar > div { height: 1px; }
.kanban-scrollbar::-webkit-scrollbar { height: 8px; }
.kanban-scrollbar::-webkit-scrollbar-thumb { background: #d3d2cf; border-radius: 4px; }
.kanban-scrollbar:hover::-webkit-scrollbar-thumb { background: #a9a8a5; }
.kanban { display: flex; gap: 16px; align-items: flex-start; min-height: 200px; }
.column { background: #f7f7f5; border-radius: 10px; padding: 10px; width: 280px; flex-shrink: 0; }
.column-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; }
.column-title { font-weight: 600; font-size: 13px; }
.column-count {
  font-size: 11px; color: #9b9a97; background: #ececea; border-radius: 10px; padding: 1px 8px;
}
.cards { display: flex; flex-direction: column; gap: 8px; min-height: 20px; }
.cards.drop-hover { outline: 2px dashed #b9c8e8; outline-offset: 2px; border-radius: 8px; }
.card {
  background: #fff; border: 1px solid #ecece9; border-radius: 8px; padding: 10px 12px;
  cursor: pointer; box-shadow: 0 1px 2px rgba(15, 15, 15, .06);
}
.card:hover { border-color: #d9d9d6; }
.card.dragging { opacity: .4; }
.card-title { font-weight: 500; margin-bottom: 4px; }
.card-excerpt { font-size: 12px; color: #787774; margin-bottom: 6px; }
.card-tags { display: none; flex-wrap: wrap; gap: 4px; }
body.show-card-tags .card-tags { display: flex; }  /* "+ Tags" on the board */
.mini-tag { font-size: 11px; color: #787774; background: #f0f0ee; padding: 1px 6px; border-radius: 8px; }
.unprioritized-label {
  font-size: 10px; letter-spacing: .08em; color: #b0afab; text-align: center;
  margin: 12px 0 6px; font-weight: 600;
}
.cards.unprioritized.empty { min-height: 36px; }

/* --------------------------------------------------------- note editor */
.note-editor { display: flex; flex-direction: column; gap: 24px; max-width: 900px; }
.note-form { display: flex; flex-direction: column; gap: 10px; }
.note-form-head { display: flex; gap: 12px; align-items: center; }
.title-label { margin-bottom: -10px; }  /* sits right on the title, not a form gap away */
.title-input {
  flex: 1; font-size: 22px; font-weight: 600; border: none; outline: none; padding: 4px 0;
  background: transparent;
}
.actions { display: flex; gap: 8px; }
.field-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #9b9a97; }
.tags-input, .body-input {
  width: 100%; border: 1px solid #e9e9e7; border-radius: 8px; padding: 10px 12px;
  font-size: 14px; font-family: inherit;
}
/* Same font as the rest of the Note (not monospace): reads like text. */
.body-input { color: #37352f; line-height: 1.7; resize: vertical; }
.note-preview {
  border-top: 1px solid #ecece9; border-bottom: 1px solid #ecece9;
  padding: 16px 0; margin: 6px 0;
}
.field-label-row { display: flex; align-items: center; gap: 6px; }
.help-toggle {
  width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 1px solid #d9d9d6;
  background: #fff; color: #9b9a97; font-size: 11px; font-weight: 600; line-height: 1;
  cursor: pointer; font-family: inherit;
}
.help-toggle:hover, .help-toggle[aria-expanded="true"] {
  background: #eef2fb; border-color: #cddbf5; color: #2f6feb;
}
.md-help {
  border: 1px solid #e9e9e7; border-radius: 8px; padding: 10px 12px; background: #fbfbfa;
  font-size: 13px; overflow-x: auto;
}
.md-help-head {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; margin-bottom: 6px;
}
.md-help-close {
  border: none; background: none; font-size: 18px; line-height: 1; color: #9b9a97; cursor: pointer;
}
.md-help table { border-collapse: collapse; width: 100%; }
.md-help th { text-align: left; font-size: 11px; font-weight: 500; color: #9b9a97; padding: 4px 8px; }
.md-help td { padding: 5px 8px; border-top: 1px solid #ecece9; vertical-align: top; }
.md-help td:first-child { white-space: nowrap; }
.md-help code { background: #f0f0ee; padding: 1px 4px; border-radius: 4px; font-size: 12px; }
.md-help-notes { margin: 8px 0 0; padding-left: 18px; color: #5f5e5b; }
.md-help-notes:first-child { margin-top: 0; }
.btn.active { background: #eef2fb; border-color: #cddbf5; color: #2f6feb; }

/* Tags field as chips (built by note_edit.js over the real input) */
.tag-field {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; cursor: text;
  border: 1px solid #e9e9e7; border-radius: 8px; padding: 6px 8px; min-height: 42px; background: #fff;
}
.tag-field:focus-within { border-color: #cddbf5; box-shadow: 0 0 0 3px #eef2fb; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 2px; font-size: 13px; line-height: 1.4;
  padding: 2px 4px 2px 10px; border-radius: 12px; background: #eef2fb; color: #2f6feb;
}
.tag-chip-remove {
  border: none; background: none; color: inherit; opacity: .6; cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 50%; font-family: inherit;
}
.tag-chip-remove:hover { opacity: 1; background: #dde6fa; }
.tag-entry {
  flex: 1; min-width: 120px; border: none; outline: none; padding: 4px 2px;
  font-size: 14px; font-family: inherit; background: transparent;
}
#tagsPanel:not([hidden]) { display: flex; flex-direction: column; gap: 12px; padding: 2px 0 6px; }
/* label in a left column, chips wrapping beside it */
.tag-suggestions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  position: relative; padding-left: 80px;
}
.tag-suggestions[hidden] { display: none; }
.tag-suggestions-label { position: absolute; left: 0; top: 5px; font-size: 11px; color: #9b9a97; }
.tag-suggest-chip {
  font-size: 12px; padding: 3px 10px; border-radius: 12px; border: 1px solid #e9e9e7;
  background: #fff; color: #5f5e5b; cursor: pointer; font-family: inherit;
}
.tag-suggest-chip:hover { background: #eef2fb; border-color: #cddbf5; color: #2f6feb; }
.tag-suggest-chip[hidden] { display: none; }
.tag-suggest-chip.board-tag { border-color: #cddbf5; color: #2f6feb; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: .9em 0 .3em; }
.markdown-body ul, .markdown-body ol { padding-left: 20px; }
.markdown-body li.task { list-style: none; margin-left: -20px; }
.markdown-body .task-box { margin: 0 6px 0 0; vertical-align: -1px; }
.markdown-body .task-box[data-line] { cursor: pointer; }
/* edit in place: each block / list item of the preview is clickable */
.markdown-body.editable .md-block { border-radius: 6px; margin: 0 -8px; padding: 0 8px; cursor: text; }
.markdown-body.editable .md-block:hover:not(.is-editing) { background: #f7f7f5; }
.markdown-body.editable .md-block > :first-child { margin-top: .4em; }
.markdown-body.editable .md-block > :last-child { margin-bottom: .4em; }
.markdown-body.editable li.is-editing { display: flex; flex-wrap: wrap; align-items: center; }
.markdown-body.editable li.is-editing > ul,
.markdown-body.editable li.is-editing > ol { flex-basis: 100%; }
.inline-edit {
  flex: 1; min-width: 0; font: inherit; color: inherit; padding: 2px 6px;
  border: 1px solid #cddbf5; border-radius: 6px; outline: none; background: #fff;
}
.inline-edit:focus { box-shadow: 0 0 0 3px #eef2fb; }
.heading-edit { display: block; width: 100%; margin: .6em 0 .3em; font-size: 1.5em; font-weight: 600; }
.block-edit { display: block; width: 100%; margin: .4em 0; resize: none; line-height: 1.6; overflow: hidden; }
.add-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.add-block {
  padding: 4px 8px; border: none; background: none; border-radius: 6px;
  color: #9b9a97; font: inherit; font-size: 13px; cursor: pointer;
}
.add-block:hover { background: #f7f7f5; color: #5f5e5b; }
.task-status { font-size: 12px; color: #9b9a97; min-height: 1em; margin-top: 6px; }
.task-status.error { color: #b3261e; }
.body-editor { display: flex; flex-direction: column; gap: 10px; }
.markdown-body code { background: #f0f0ee; padding: 1px 4px; border-radius: 4px; }
.markdown-body pre { background: #f7f7f5; padding: 12px; border-radius: 8px; overflow-x: auto; }
.markdown-body table { border-collapse: collapse; }
.markdown-body th, .markdown-body td { border: 1px solid #e9e9e7; padding: 4px 8px; }

.note-index { list-style: none; padding: 0; margin: 0; max-width: 720px; }
.note-index li {
  padding: 10px 4px; border-bottom: 1px solid #f0f0ee;
  display: flex; justify-content: space-between; gap: 12px;
}
.note-index a { font-weight: 500; }
.note-index-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ------------------------------------------- tags page / group tag edits */
.section-title a { color: inherit; }
.section-title a:hover { color: #37352f; }
.tag-page { max-width: 720px; }
.tag-page-bar, .tag-refine { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.tag-page-bar input[type="search"], .tag-refine input[type="search"] { flex: 1; min-width: 180px; }
.tag-counts { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-counts label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.tag-count { font-size: 11px; color: #9b9a97; }
.tag-edit { border: 1px solid #ecece9; border-radius: 8px; padding: 10px 12px; margin: 12px 0; max-width: 720px; }
.tag-edit legend { font-size: 12px; color: #787774; padding: 0 4px; }
.tag-edit-actions, .tag-edit-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.tag-edit-fields { margin-top: 8px; }
.tag-edit-fields label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #787774; }
.tag-edit-fields label[hidden] { display: none; }
.tag-edit-fields .tags-input { min-width: 200px; background: #fff; }
.tag-select-all { margin: 4px 4px 0; font-size: 12px; color: #787774; }
.tag-note-pick { display: flex; align-items: center; gap: 8px; }
.tag-board-offer { display: block; margin: 12px 0; max-width: 720px; }
.tag-preview-buttons { display: flex; gap: 8px; margin: 12px 0; }
.mini-tag.removed { background: #fdecea; color: #b3261e; text-decoration: line-through; }
.mini-tag.added { background: #e8f3ea; color: #1e7a34; }

/* --------------------------------------------------------- editor toolbar */
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
/* "Criada": same pill as the dates, but plain text (set automatically). */
.date-field.readonly { background: #f7f7f5; padding-right: 10px; cursor: default; }
.date-value { font-size: 12px; padding: 2px; color: #787774; }
/* "+ Tags" "+ Início e prazo" "+ Markdown": buttons that unfold a panel */
.fold-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fold-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  font-size: 12px; font-family: inherit; padding: 3px 10px; border-radius: 12px;
  border: 1px dashed #d9d9d6; background: #fff; color: #787774;
}
.fold-btn::before { content: "+"; }
.fold-btn[aria-expanded="true"]::before { content: "\2212"; }
.fold-btn:hover, .fold-btn[aria-expanded="true"] { background: #eef2fb; border-color: #cddbf5; color: #2f6feb; }
.fold-count:empty { display: none; }
.fold-count {
  font-size: 11px; line-height: 1; padding: 2px 6px; border-radius: 8px;
  background: #eef2fb; color: #2f6feb;
}
.fold-btn[aria-expanded="true"] .fold-count { background: #fff; }
.fold-panel[hidden] { display: none; }
.date-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.history li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  font-size: 13px; padding-left: 12px; border-left: 2px solid #e9e9e7;
}
.history li:last-child { border-left-color: #2f6feb; }
.history-tag { font-weight: 600; }
.history-dates { color: #5f5e5b; }
.history-days { color: #9b9a97; font-size: 12px; }
.history-empty { padding: 0; }
/* Each date is a pill like the filter chips: label + input inside one border. */
.date-field {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 10px;
  border: 1px solid #e9e9e7; border-radius: 12px; background: #fff;
}
.date-field:focus-within { border-color: #cddbf5; }
.date-field .field-label { font-size: 12px; text-transform: none; letter-spacing: 0; color: #5f5e5b; }
/* Agenda icons beside the dates, same height as the date pills. */
.agenda-row { display: flex; gap: 6px; }
.agenda-row[hidden] { display: none; }
.agenda-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 26px; border: 1px solid #e9e9e7; border-radius: 12px;
  color: #787774; background: #fff;
}
.agenda-icon:hover { background: #eef2fb; border-color: #cddbf5; color: #2f6feb; }
.agenda-icon svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.agenda-icon svg text {
  fill: currentColor; stroke: none; font-size: 9px; font-weight: 700; font-family: inherit;
}
.agenda-hint { flex-basis: 100%; font-size: 12px; }
.date-input {
  border: none; padding: 2px; outline: none;
  font-size: 12px; font-family: inherit; color: inherit; background: transparent;
}

/* --------------------------------------------------------- due dates */
.card-due {
  display: inline-block; margin-bottom: 6px; font-size: 11px; color: #787774; background: #f0f0ee;
  padding: 1px 7px; border-radius: 8px; white-space: nowrap;
}
.card-due.due-overdue { color: #b42318; background: #fdecea; }
.card-due.due-soon { color: #8a5a00; background: #fdf3d8; }
.card-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.card-due.due-done { text-decoration: line-through; }
.card-done {
  display: inline-block; margin-bottom: 6px; font-size: 11px; color: #1e7a3c; background: #e3f4e8;
  padding: 1px 7px; border-radius: 8px; white-space: nowrap;
}
.card-age {
  display: inline-block; margin-bottom: 6px; font-size: 11px; color: #787774; background: #f0f0ee;
  padding: 1px 7px; border-radius: 8px; white-space: nowrap;
}
.card-age.age-aging { color: #8a5a00; background: #fdf3d8; }
.card-age.age-stale { color: #b42318; background: #fdecea; }
.board-folds { margin-bottom: 10px; }
.gf-sep { width: 1px; height: 16px; background: #e9e9e7; margin: 0 4px; }
.col-sort { display: contents; }
.col-sort-btn {
  border: none; background: none; cursor: pointer; font-size: 13px; line-height: 1;
  color: #9b9a97; padding: 0 5px; border-radius: 4px; font-family: inherit;
}
.col-sort-btn:hover { background: #ececea; color: #37352f; }

/* --------------------------------------------------------- wikilinks */
.markdown-body .wikilink { color: #2f6feb; border-bottom: 1px solid #cddbf5; }
.markdown-body .wikilink:hover { background: #eef2fb; }
.markdown-body .wikilink.missing { color: #b0793a; border-bottom: 1px dashed #e3c9a8; }

.wikilink-suggest {
  border: 1px solid #e9e9e7; border-radius: 8px; background: #fff; margin-top: 4px;
  box-shadow: 0 4px 14px rgba(15, 15, 15, .1); max-height: 220px; overflow-y: auto;
}
.wikilink-suggest-item { padding: 8px 12px; font-size: 13px; cursor: pointer; }
.wikilink-suggest-item.active, .wikilink-suggest-item:hover { background: #eef2fb; }

.backlinks { border-top: 1px solid #ecece9; padding-top: 12px; margin-top: 20px; }
.backlinks ul { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 4px; }
.backlinks a { color: #2f6feb; font-size: 13px; }

/* --------------------------------------------------------- new board form */
.board-form { max-width: 720px; display: flex; flex-direction: column; gap: 8px; }
.col-rows { margin-top: 4px; }
.col-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; margin-bottom: 8px;
}
.col-row label.col-done {
  flex-direction: row; align-items: center; justify-content: flex-end; gap: 5px; padding-top: 16px;
  font-size: 12px; cursor: pointer;
}
.col-row .col-done input { margin: 0; padding: 0; }
.col-row label {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #9b9a97;
}
.col-row input {
  border: 1px solid #e9e9e7; border-radius: 6px; padding: 8px 9px;
  font-size: 14px; font-family: inherit; color: #37352f;
}
/* Suggestions (placeholders) clearly lighter than what is really filled in. */
.col-row input::placeholder { color: #cfcecb; font-style: italic; }

/* --------------------------------------------------------- card expand / move */
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.card-head .card-title { margin-bottom: 4px; }
.card-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.card-toggle, .card-move, .card-duplicate {
  border: none; background: transparent; cursor: pointer;
  color: #9b9a97; font-size: 12px; line-height: 1; padding: 3px 5px; border-radius: 4px;
}
.card-toggle:hover, .card-move:hover, .card-duplicate:hover { background: #efefee; color: #37352f; }
.card-more {
  display: none; white-space: pre-wrap; font-size: 12px; color: #5f5e5b;
  margin: 2px 0 6px; padding-top: 6px; border-top: 1px solid #efefee;
  max-height: 160px; overflow: auto;
}
.card.expanded .card-more { display: block; }

.column-head-right { display: flex; align-items: center; gap: 6px; }
.col-add {
  font-size: 14px; line-height: 1; color: #9b9a97; padding: 0 5px; border-radius: 4px;
}
.col-add:hover { background: #ececea; color: #37352f; }

/* --------------------------------------------------------- move sheet */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(15, 15, 15, .4);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-backdrop[hidden] { display: none; }
.move-sheet {
  background: #fff; width: 100%; max-width: 460px; border-radius: 14px 14px 0 0;
  padding: 16px; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 -4px 24px rgba(15, 15, 15, .18);
}
.move-sheet-head { display: flex; justify-content: space-between; align-items: center; }
.move-sheet-head strong { font-size: 14px; }
.sheet-close {
  border: none; background: transparent; font-size: 16px; cursor: pointer;
  color: #787774; padding: 4px 8px;
}
.move-sheet-title { color: #787774; font-size: 13px; margin: 4px 0 12px; }
.move-cols { display: flex; flex-direction: column; gap: 6px; }
.move-col-btn, .move-reorder button {
  text-align: left; padding: 12px 14px; border: 1px solid #e9e9e7; border-radius: 8px;
  background: #fff; font-size: 15px; cursor: pointer; color: #37352f; font-family: inherit;
}
.move-col-btn.current { background: #f4f4f2; font-weight: 600; }
.move-reorder { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.move-reorder button { flex: 1; min-width: 120px; text-align: center; }
.move-reorder button:disabled { opacity: .4; cursor: default; }
body.sheet-open { overflow: hidden; }
@media (min-width: 560px) {
  .sheet-backdrop { align-items: center; }
  .move-sheet { border-radius: 14px; }
}

/* --------------------------------------------------------- responsive */
.sidebar-toggle {
  display: none; align-items: center; justify-content: center;
  background: #fff; border: 1px solid #e9e9e7; border-radius: 8px;
  padding: 7px 11px; cursor: pointer; font-size: 15px; line-height: 1;
}
.sidebar-close { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 820px) {
  .layout { min-height: 100dvh; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 30; width: 264px;
    height: 100vh; height: 100dvh;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 30px rgba(15, 15, 15, .25); }
  .sidebar-close {
    display: block; position: absolute; top: 10px; right: 10px;
    border: none; background: transparent; font-size: 16px; color: #787774;
    padding: 6px 8px; cursor: pointer;
  }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 25; background: rgba(15, 15, 15, .35);
  }
  .sidebar-backdrop[hidden] { display: none; }
  .sidebar-toggle { display: inline-flex; }
  body.nav-open { overflow: hidden; }

  .content { padding: 0 14px 40px; }
  .topbar { gap: 10px; }
  .search input, .search-input { max-width: none; }

  /* font-size >= 16px keeps iOS from auto-zooming on focus */
  .search input, .search-input, .tags-input, .tag-entry, .body-input, .title-input,
  .col-row input, .login-card input, .account-field input { font-size: 16px; }

  .board-head { flex-wrap: wrap; }


  .col-row { grid-template-columns: 1fr; }

  .kanban-wrap { scroll-snap-type: x mandatory; }
  .kanban { gap: 12px; }
  .column { width: 82vw; scroll-snap-align: start; }
  .card-more { max-height: 40vh; }

  .nav-link { padding: 10px 8px; }
  .tag { padding: 6px 11px; font-size: 13px; }
  .chip { padding: 7px 12px; }
  .col-add { padding: 6px 12px; font-size: 18px; }
  .card-toggle, .card-move, .card-duplicate { padding: 8px 10px; font-size: 14px; }
}

/* ------------------------------------------------------- view switch / gantt */
.view-switch {
  display: inline-flex; border: 1px solid #e3e3e0; border-radius: 8px; overflow: hidden;
  background: #fff; align-self: center;
}
.view-switch a { padding: 4px 12px; font-size: 13px; color: #5f5e5b; text-decoration: none; }
.view-switch a + a { border-left: 1px solid #e3e3e0; }
.view-switch a:hover { background: #f4f4f2; }
.view-switch a.on { background: #eef2fb; color: #2f6feb; }
.view-switch.small a { font-size: 12px; padding: 3px 10px; }

.gantt-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 16px; margin-bottom: 10px;
}
.gantt-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: #5f5e5b; }
.g-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.g-swatch { width: 14px; height: 8px; border-radius: 2px; display: inline-block; }
.g-open { background: #5a84cc; }
.g-done { background: #7cc395; }
.g-swatch-delay { background: repeating-linear-gradient(45deg, #e5534b 0 3px, #f3aaa5 3px 6px); }

.gantt-wrap { overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.gantt-wrap::-webkit-scrollbar { display: none; }  /* replaced by .kanban-scrollbar */
.gantt { --label: 220px; width: calc(var(--label) + var(--timeline)); }
.g-row { display: flex; height: 30px; border-bottom: 1px solid #efefed; }
.g-label {
  position: sticky; left: 0; z-index: 2; flex: none; width: var(--label); box-sizing: border-box;
  padding: 0 10px 0 2px; line-height: 30px; background: #f7f7f5;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px;
}
a.g-note { color: #37352f; text-decoration: none; }
a.g-note:hover { color: #2f6feb; }
.g-track { position: relative; flex: none; width: var(--timeline); display: block; }
.g-axis { height: 36px; border-bottom-color: #e3e3e0; }
.g-tick {
  position: absolute; top: 0; height: 20px; padding: 3px 0 0 4px; font-size: 11px; color: #9b9a97;
  border-left: 1px solid #e3e3e0; white-space: nowrap;
}
.g-today-label { position: absolute; bottom: 1px; font-size: 10px; color: #2f6feb; transform: translateX(-50%); }
.g-group { height: 34px; }
.g-group .g-label { font-weight: 600; line-height: 40px; }
.g-fold {
  border: none; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer;
}
.g-fold::before { content: "▾"; display: inline-block; width: 14px; color: #9b9a97; }
.g-fold[aria-expanded="false"]::before { content: "▸"; }
.g-fold:hover::before { color: #37352f; }
.g-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: #efefed; }
.g-today { position: absolute; top: 0; bottom: 0; background: rgba(47, 111, 235, .07);
           border-left: 1px solid rgba(47, 111, 235, .45); box-sizing: border-box; }

.g-bar { position: absolute; top: 9px; height: 12px; border-radius: 3px; }
a.g-track:hover .g-bar { filter: brightness(.93); }
.g-early, .g-early-swatch {
  background: #e6f4ea; border: 1px dashed #7cc395; box-sizing: border-box;
}
.g-early { position: absolute; top: 9px; height: 12px; border-radius: 0 3px 3px 0; border-left: none; }
.g-end-label { position: absolute; top: 7px; font-size: 11px; color: #1e7a3c; white-space: nowrap; }
.g-end-label.late { color: #b42318; }
.g-delay {
  position: absolute; top: 9px; height: 12px; border-radius: 0 3px 3px 0;
  background: repeating-linear-gradient(45deg, #e5534b 0 3px, #f3aaa5 3px 6px);
}

.g-undated { margin-top: 24px; }
.g-undated .muted { padding: 0; margin: 6px 0 0; }
.g-undated-title { font-weight: 600; }
.g-undated-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
@media (max-width: 720px) {
  .gantt { --label: 130px; }
}

/* ------------------------------------------------------- calendar */
.cal-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 16px; margin-bottom: 10px;
}
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-title { font-size: 15px; font-weight: 600; margin: 0 4px; min-width: 130px; text-align: center; }
.cal-nav-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px;
  border: 1px solid #e9e9e7; border-radius: 12px; font-size: 18px; line-height: 1; color: #5f5e5b;
}
.cal-nav-btn:hover { background: #eef2fb; border-color: #cddbf5; color: #2f6feb; }
.cal-swatch { width: 14px; height: 8px; border-radius: 2px; display: inline-block; border: 1px solid; }

.cal { border: 1px solid #e9e9e7; border-radius: 10px; overflow: hidden; background: #fff; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head { background: #f7f7f5; border-bottom: 1px solid #e9e9e7; }
.cal-head div { padding: 6px 8px; font-size: 11px; color: #9b9a97; text-transform: uppercase; letter-spacing: .06em; }
.cal-week { min-height: 96px; row-gap: 2px; padding-bottom: 4px; }
.cal-week + .cal-week { border-top: 1px solid #efefed; }
/* Background cell of each day: spans every row of the week, behind the events. */
.cal-day { grid-row: 1 / -1; margin-bottom: -4px; }
.cal-day + .cal-num + .cal-day { border-left: 1px solid #efefed; }
.cal-day.out { background: #fafaf9; }
.cal-day.today { background: #f5f8fe; }
.cal-num { grid-row: 1; padding: 4px 8px 2px; font-size: 12px; color: #5f5e5b; }
.cal-num.out { color: #c4c3bf; }
.cal-num.today { color: #2f6feb; font-weight: 700; }

.cal-ev {
  margin: 0 4px; padding: 1px 6px; border-radius: 6px; border: 1px solid;
  font-size: 12px; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; position: relative;
}
.cal-ev:hover { filter: brightness(.96); }
.cal-ev.cont-before { margin-left: 0; border-left: none; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-ev.cont-after { margin-right: 0; border-right: none; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-overdue { background: #fdecea; color: #b42318; border-color: #f6c9c4; }
.cal-soon { background: #fdf3d8; color: #8a5a00; border-color: #f1dca4; }
.cal-later { background: #eef2fb; color: #2f6feb; border-color: #cddbf5; }
.cal-done { background: #e3f4e8; color: #1e7a3c; border-color: #bfe3ca; }
.cal-ev.cal-done { text-decoration: line-through; opacity: .75; }
.cal-none { background: #f0f0ee; color: #5f5e5b; border-color: #e3e3e0; }

@media (max-width: 720px) {
  .cal-week { min-height: 72px; }
  .cal-head div { padding: 4px; text-align: center; }
  .cal-num { padding: 2px 4px; font-size: 11px; }
  .cal-ev { margin: 0 2px; padding: 0 3px; font-size: 10px; border-radius: 4px; }
}

/* Board graph (network) view */
.graph-hint { margin: 6px 0 10px; font-size: 13px; }
.graph-wrap {
  position: relative;
  width: 100%;
  height: 72vh;
  min-height: 360px;
  border: 1px solid #e3e3e0;
  border-radius: 10px;
  background: #fcfcfb;
  overflow: hidden;
}
.graph-wrap canvas { display: block; }
.graph-empty { position: absolute; top: 16px; left: 0; right: 0; margin: 0; text-align: center; }
.graph-nav { position: absolute; top: 10px; right: 10px; z-index: 2; display: flex; flex-direction: column; gap: 4px; }
.graph-nav button {
  width: 30px; height: 30px; padding: 0; font-size: 17px; line-height: 1;
  border: 1px solid #d9d9d6; border-radius: 7px; background: #fff; color: #37352f;
  cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.graph-nav button:hover { background: #f4f4f2; }
