html, body { min-height: 100vh; }
body {
  display: flex;
  flex-direction: column;
  max-width: none;
  width: 100%;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand img { border-radius: 6px; }
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--border);
}
.tab {
  flex: 1;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 8px;
  border-radius: 999px;
}
.tab.active {
  background: var(--primary-container);
  color: var(--primary);
  font-weight: 600;
}
main {
  flex: 1;
  overflow: auto;
  padding: 12px 16px 20px;
  width: 100%;
}
.board-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: start;
  justify-content: flex-start;
  min-height: 0;
}
.board-col {
  display: none;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 0;
  height: fit-content;
  flex: 1 1 260px;
  min-width: min(100%, 240px);
  max-width: 400px;
  box-sizing: border-box;
}
.board-list-view.has-bg .board-col {
  background: color-mix(in srgb, var(--surface) 42%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  backdrop-filter: blur(2px);
}
.board-col.active { display: flex; }
.board-col.inbox {
  display: flex;
  order: -1;
  border-color: color-mix(in srgb, var(--accent, #4C8BF5) 35%, var(--border));
}
.board-col.inbox .board-col-head { cursor: default; }
.board-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
}
.board-col.dragging-col { opacity: 0.5; }
.board-col-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 24px;
}
@media (min-width: 800px) {
  .board-col { display: flex; }
  .board-nav-narrow { display: none !important; }
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.hidden { display: none !important; }
.list { gap: 6px; margin-top: 4px; }
.editor-view { gap: 10px; }
.chip-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
}
.chip-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary-container) 50%, var(--surface-2));
}
.swatch {
  width: 28px !important;
  height: 28px;
  border-radius: 50% !important;
  background: var(--c) !important;
  border: 2px solid var(--border) !important;
  padding: 0 !important;
}
.rem-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.rem-actions button {
  padding: 3px 8px;
  font-size: 11px;
}
.help {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 11px;
}
.help li { margin-bottom: 4px; }
.help code { color: var(--text); }
.tag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.tag-row .dot {
  width: 12px; height: 12px; border-radius: 50%;
}
.editor-body:empty:before {
  content: attr(data-placeholder);
  color: var(--muted);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block;
  background: var(--muted);
}
.status-dot.active { background: var(--ok); }
.status-dot.snoozed { background: var(--warn); }
.status-dot.done { background: var(--muted); }
.board-dots { justify-content: center; gap: 6px; padding: 8px 0; }
.board-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border);
  cursor: pointer;
}
.board-dot.active { background: var(--primary); width: 8px; height: 8px; }
.kanban-column {
  min-height: 180px;
  padding: 4px;
  border: 1px dashed transparent;
  border-radius: var(--radius-sm);
}
.kanban-column.drop-ready {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary-container) 25%, transparent);
}
.kanban-card {
  position: relative;
}
.kanban-card.dragging { opacity: 0.45; }
.kanban-card .card-menu,
.note-card .card-menu {
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.prio-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #E74C3C;
  display: inline-block;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.check-row input[type="checkbox"] { width: auto; }
.progress {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--primary);
}
.progress-btns button {
  padding: 3px 8px;
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.progress-btns button.active {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.kanban-card .card-done {
  width: 16px;
  height: 16px;
  margin: 0 6px 0 0;
  flex-shrink: 0;
  accent-color: var(--primary);
}
.card-due {
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  display: inline-block;
  background: transparent;
}
.card-due.due-soon {
  background: #ffe066;
  color: #111;
}
.card-due.overdue {
  background: #ff6b6b;
  color: #111;
}
.kanban-card.due-soon {
  border: 2px solid #e6c200;
}
.kanban-card.overdue {
  border: 2px solid var(--danger);
}
.board-col-actions { display: flex; gap: 2px; }
.board-col-actions button {
  padding: 2px 7px;
  font-size: 12px;
  min-height: 28px;
}
.add-in-col {
  width: 100%;
  margin-top: auto;
}
.check-row {
  flex-wrap: wrap;
}
.check-meta {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding-left: 24px;
}
.check-meta input[type="date"] {
  width: auto;
  flex: 0 0 auto;
}
.check-meta .row.wrap {
  flex: 1 1 160px;
}
.check-row input[type="text"] {
  min-width: 0;
}
.card-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 36px;
  align-items: center;
  justify-content: flex-start;
}
.card-meta-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.checklist-add {
  margin-top: 28px;
}
.card-meta-row input[type="date"] {
  width: auto;
  flex: 0 0 auto;
  min-width: 9.6rem;
  max-width: 11rem;
}
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
}
.color-swatch.selected {
  outline: 2px solid #111;
  outline-offset: 2px;
}
.kanban-card {
  color: #111;
}
.board-list-view.has-bg .board-columns {
  background-image: url("../img/board-bg.svg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: var(--radius);
  padding: 10px;
  min-height: calc(100dvh - 280px);
}
.gantt { overflow-x: auto; margin-top: 8px; }
.gantt-head, .gantt-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 8px;
  align-items: center;
  min-width: 640px;
}
.gantt-row {
  cursor: pointer;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.gantt-label { display: flex; flex-direction: column; gap: 2px; }
.gantt-track { display: grid; gap: 1px; }
.gantt-day, .gantt-cell {
  font-size: 10px;
  text-align: center;
  color: var(--muted);
}
.gantt-cell {
  height: 14px;
  background: var(--surface-2);
  border-radius: 3px;
}
.gantt-cell.bar { background: var(--primary); }
.gantt-cell.weekend, .gantt-day.weekend {
  background: color-mix(in srgb, #5b6478 28%, var(--surface-2));
}
.gantt-day.weekend { border-radius: 3px; }
.gantt-cell.today, .gantt-day.today {
  box-shadow: inset 2px 0 0 #ff5c7a, inset -2px 0 0 #ff5c7a;
}
.gantt-day.today { color: #ff5c7a; font-weight: 700; }
.note-preview {
  pointer-events: none;
  max-height: 280px;
  overflow: hidden;
  min-height: 0;
  background: transparent;
  border: none;
  padding: 4px 0;
  color: inherit;
}
.note-preview ul, .note-preview ol { padding-left: 1.3em; margin: 4px 0; }
.note-preview p { margin: 0 0 6px; }
.note-card { cursor: pointer; }
.notes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
  margin-top: 4px;
}
.notes-grid .empty { grid-column: 1 / -1; }
@media (min-width: 720px) {
  .notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .notes-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1500px) {
  .notes-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
#ganttBoards { min-height: 72px; }
.toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}
.rich-toolbar select {
  width: auto;
  min-width: 120px;
  padding: 4px 8px;
}
.swatch-none {
  background-image: linear-gradient(135deg, transparent 46%, #c44 50%, transparent 54%) !important;
  background-color: var(--surface-2) !important;
}
.editor-body ul, .editor-body ol {
  padding-left: 1.4em;
  margin: 6px 0;
}
.editor-body a {
  color: #1a5fd6;
  text-decoration: underline;
}
.editor-body ul.task-list,
.note-preview ul.task-list {
  list-style: none;
  margin: 6px 0 6px 1.6em;
  padding: 0;
}
.editor-body li.task-item,
.note-preview li.task-item {
  position: relative;
  margin: 0.15em 0;
  min-height: 1.35em;
}
.editor-body li.task-item > input[type="checkbox"],
.note-preview li.task-item > input[type="checkbox"] {
  position: absolute;
  left: -1.45em;
  top: 0.22em;
  width: 1em;
  height: 1em;
  margin: 0;
  padding: 0;
  cursor: pointer;
}
.editor-body li.task-item .task-body {
  display: block;
}
.editor-body li.task-item.is-done .task-body {
  text-decoration: line-through;
  opacity: 0.75;
}
.task-line {
  display: none;
}

.board-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.board-row .grow { min-width: 80px; }

button, .tab, .tag-chip, .list-item, .chip-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: color-mix(in srgb, var(--primary) 25%, transparent);
  cursor: pointer;
}

.ui-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ui-modal.hidden { display: none !important; }
.ui-modal-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.ui-modal-card p { margin: 0 0 10px; }

.assets-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-height: 60vh;
}
.asset-tree {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 50vh;
  overflow: auto;
}
.asset-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 50vh;
}
.asset-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  margin-left: calc(var(--d, 0) * 14px);
  border-radius: 8px;
  cursor: pointer;
}
.asset-row:hover { background: var(--surface-2); }
.asset-row.selected { background: var(--primary-container); }
.asset-tab-row, .asset-item-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  margin-left: calc(var(--d, 0) * 14px);
  border-radius: 8px;
  cursor: pointer;
}
.asset-tab-row { color: var(--muted); font-size: 13px; }
.asset-item-row { cursor: grab; font-size: 13px; }
.asset-file-link { color: var(--primary); text-decoration: underline; cursor: pointer; }
.asset-file-link:hover { filter: brightness(1.1); }
.asset-grip { color: var(--muted); letter-spacing: -2px; margin-right: 6px; cursor: grab; }
.editor-body { min-height: 180px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.asset-item-row.dragging, tr.dragging { opacity: 0.5; }
.asset-tab-row.selected, .asset-item-row:hover, .asset-tab-row:hover { background: var(--surface-2); }
.asset-tab-row.selected { background: var(--primary-container); color: inherit; }
.drop-ok { outline: 2px dashed var(--primary, #4c8bf5); background: var(--primary-container); }
.asset-table tr[draggable="true"] { cursor: grab; }
.asset-twist, .asset-twist-spacer {
  width: 28px;
  min-width: 28px;
  padding: 2px 4px;
  text-align: center;
}
.asset-table-wrap { overflow: auto; }
.asset-table { width: 100%; border-collapse: collapse; }
.asset-table th, .asset-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.asset-table th { color: var(--muted); font-weight: 600; }

.card-editor-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 16px;
  align-items: start;
}
.card-comments {
  position: sticky;
  top: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface, #fff);
  max-height: calc(100vh - 120px);
  overflow: auto;
}
.card-comment {
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}
.card-comment .meta { color: var(--muted); font-size: 12px; }
.checklist-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 10px;
}
.check-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: center;
  margin: 6px 0;
}
.check-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.kanban-card.completed h4 { text-decoration: line-through; opacity: 0.7; }

@media (max-width: 720px) {
  body {
    max-width: none;
    box-shadow: none;
  }
  .tabs {
    flex-wrap: wrap;
  }
  .tab, button.primary, button.ghost, button.danger {
    min-height: 44px;
  }
  input, select, textarea {
    font-size: 16px;
  }
  .progress-btns button {
    min-height: 40px;
    min-width: 44px;
    font-size: 13px;
  }
  .assets-layout {
    grid-template-columns: 1fr;
  }
  .card-editor-split {
    grid-template-columns: 1fr;
  }
  .card-comments {
    position: static;
    max-height: none;
  }
}
