/* Kanban toolbar + board — loaded separately so it is not blocked by site.css cache */
.kb-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 16px 18px 14px;
  margin-bottom: 16px;
  overflow: visible;
}
.kb-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.kb-seg {
  display: inline-flex;
  background: var(--bg-input, #F9FAFB);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.kb-seg a, .kb-seg button {
  border: 0;
  background: transparent;
  color: var(--text-secondary, #6B7280);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.kb-seg a.active, .kb-seg button.active {
  background: var(--bg-card);
  color: var(--primary, #4F46E5);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.kb-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #6B7280);
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.kb-switch input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.kb-switch-ui {
  width: 36px; height: 20px;
  background: var(--border, #E5E7EB);
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  display: inline-block;
}
.kb-switch-ui::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--bg-card, #fff);
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.kb-switch input:checked + .kb-switch-ui { background: var(--primary, #4F46E5); }
.kb-switch input:checked + .kb-switch-ui::after { transform: translateX(16px); }

.kb-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.kb-chip, .kb-week { font: inherit; appearance: none; -webkit-appearance: none; }
.kb-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border, #E5E7EB);
  background: var(--bg-input, #F9FAFB);
  color: var(--text-secondary, #6B7280);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.kb-chip:hover { border-color: var(--primary-light, #818CF8); color: var(--primary, #4F46E5); background: var(--primary-50, #EEF2FF); }
.kb-chip.active {
  background: var(--primary-50, #EEF2FF);
  border-color: var(--primary-100, #E0E7FF);
  color: var(--primary-dark, #4338CA);
}
.kb-chip.danger { color: #EF4444; background: #FEF2F2; border-color: transparent; }
.kb-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }

.kb-weeks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 4px;
}
.kb-week {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border, #E5E7EB);
  background: var(--bg-input, #F9FAFB);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.kb-week:hover { border-color: var(--primary-light, #818CF8); background: var(--primary-50, #EEF2FF); }
.kb-week.active {
  background: linear-gradient(135deg, #4F46E5, #4338CA);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(79,70,229,0.22);
}
.kb-week-label { font-size: 12px; font-weight: 600; }
.kb-week-count {
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  background: var(--bg-card, #fff);
  color: var(--primary-dark, #4338CA);
}
.kb-week.active .kb-week-count { background: rgba(255,255,255,0.2); color: #fff; }

.kb-week-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 14px;
}
.kb-week-nav a {
  width: 32px; height: 32px;
  border-radius: 10px;
  border: 1px solid var(--border, #E5E7EB);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary, #6B7280);
  background: var(--bg-card, #fff);
  text-decoration: none;
}
.kb-week-nav strong { font-size: 13px; }

.kb-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.kb-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border, #E5E7EB);
  background: var(--bg-card, #fff);
  color: var(--text-secondary, #6B7280);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.kb-filter-btn:hover, .kb-filter-btn.open, .kb-filter-btn.active {
  border-color: var(--primary-100, #C7D2FE);
  color: var(--primary-dark, #4338CA);
  background: var(--primary-50, #EEF2FF);
}
.kb-filter-chevron { font-size: 11px; transition: transform 0.2s ease; }
.kb-filter-btn.open .kb-filter-chevron { transform: rotate(180deg); }

.kb-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light, #F3F4F6);
}
#kbFilterForm.kb-filters { display: none; }
#kbFilterForm.kb-filters.is-open { display: flex; }
.kb-field { margin: 0; display: flex; flex-direction: column; gap: 5px; flex: 1 1 160px; min-width: 140px; max-width: 100%; }
.kb-actions {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.kb-actions-btns {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.kb-field label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted, #9CA3AF);
  margin: 0;
}
.kb-field .form-control,
.kb-field select,
.kb-field input[type="date"] {
  height: 38px;
  border-radius: 10px;
  background: var(--bg-input, #F9FAFB);
  border: 1px solid var(--border, #E5E7EB);
  font-size: 13px;
  padding: 0 10px;
  width: 100%;
}
.kb-check {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--bg-input, #F9FAFB);
  border: 1px solid var(--border, #E5E7EB);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #6B7280);
  cursor: pointer;
  white-space: nowrap;
  margin: 0;
}
.kb-apply {
  height: 38px;
  border: 0;
  border-radius: 10px;
  padding: 0 18px;
  background: linear-gradient(135deg, #4F46E5, #4338CA);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(79,70,229,0.2);
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kb-board {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-height: 400px;
  align-items: start;
}
.kb-col {
  background: var(--bg-input, #F9FAFB);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 16px;
  padding: 10px;
  min-height: 320px;
}
.kb-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 10px;
  margin-bottom: 4px;
}
.kb-col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kb-col-title { font-size: 13px; font-weight: 700; color: var(--text-primary, #111827); }
.kb-col-count {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kb-card {
  display: block;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 12px;
  padding: 12px 12px 12px 15px;
  margin-bottom: 8px;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(0,0,0,0.04));
}
.kb-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--kb-accent, #3B82F6);
}
.kb-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.kb-card-project {
  border-color: #F9A8D4;
  background: #FDF2F8;
  box-shadow: 0 0 0 1px #FBCFE8;
}
.kb-card-project:hover {
  border-color: #F472B6;
  box-shadow: 0 4px 12px rgba(244, 114, 182, 0.22);
}
.kb-card-title { font-size: 13px; font-weight: 700; line-height: 1.35; margin-bottom: 6px; }
.kb-card-desc { font-size: 12px; color: var(--text-muted, #9CA3AF); line-height: 1.45; margin-bottom: 8px; }
.kb-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kb-card-file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  opacity: 0.85;
  flex-shrink: 0;
}
.kb-empty { text-align: center; padding: 28px 12px; color: var(--text-muted, #9CA3AF); font-size: 12px; }

.kb-create {
  background: var(--bg-card);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 6px 8px;
  margin-bottom: 16px;
}
.kb-create-sum {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  cursor: pointer;
  user-select: none;
  border-radius: 14px;
}
.kb-create-sum::-webkit-details-marker,
.kb-create-sum::marker { display: none; content: ""; }
.kb-create-sum:hover { background: var(--bg-input, #F9FAFB); }
.kb-create-ico {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4F46E5, #4338CA);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(79,70,229,0.22);
}
.kb-create-sum strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #111827);
}
.kb-create-chevron {
  margin-left: auto;
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border, #E5E7EB);
  background: var(--bg-card, #fff);
  color: var(--text-secondary, #6B7280);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.kb-create details[open] .kb-create-chevron { transform: rotate(180deg); }
.kb-create-form {
  padding: 4px 12px 16px;
  border-top: 1px solid var(--border-light, #F3F4F6);
  margin: 0 6px 6px;
}
.kb-create-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding-top: 14px;
}
.kb-span-4 { grid-column: 1 / -1; }
.kb-create .kb-field input[type="number"] { height: 38px; }
.kb-prio {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.kb-prio label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.kb-prio input { position: absolute; opacity: 0; pointer-events: none; }
.kb-prio span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border, #E5E7EB);
  background: var(--bg-input, #F9FAFB);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #6B7280);
}
.kb-prio input:checked + span {
  background: var(--bg-card, #fff);
  border-color: var(--primary-100, #C7D2FE);
  color: var(--primary-dark, #4338CA);
  box-shadow: 0 0 0 3px var(--shadow-glow, rgba(79,70,229,0.12));
}
.kb-prio .dot { width: 8px; height: 8px; border-radius: 50%; }
.kb-editor {
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-card, #fff);
}
.kb-editor .ql-toolbar.ql-snow {
  border: 0;
  border-bottom: 1px solid var(--border-light, #F3F4F6);
  background: var(--bg-input, #F9FAFB);
  padding: 8px 10px;
}
.kb-editor .ql-container.ql-snow {
  border: 0;
  font-size: 13px;
  min-height: 112px;
}
.kb-editor .ql-editor { min-height: 112px; padding: 12px 14px; }
.kb-editor .ql-editor.ql-blank::before {
  color: var(--text-muted, #9CA3AF);
  font-style: normal;
  left: 14px;
}
.kb-create-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.kb-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px dashed var(--border, #E5E7EB);
  background: var(--bg-input, #F9FAFB);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #6B7280);
  cursor: pointer;
  margin: 0;
  max-width: 100%;
}
.kb-file input { display: none; }
.kb-file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.kb-file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.kb-file-preview:empty { display: none; margin: 0; }
.kb-file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--border, #E5E7EB);
  background: var(--bg-card, #fff);
  max-width: 240px;
  font-size: 11px;
  font-weight: 600;
  position: relative;
}
.kb-file-remove {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted, #94A3B8);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kb-file-remove:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #EF4444;
}
.kb-file-chip img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--bg-input, #F9FAFB);
}
.kb-file-chip .kb-file-meta {
  min-width: 0;
  flex: 1;
}
.kb-file-chip .kb-file-meta a,
.kb-file-chip .kb-file-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--primary, #4F46E5);
  text-decoration: none;
}
.kb-file-chip .kb-file-size {
  color: var(--text-muted, #94A3B8) !important;
  font-weight: 500;
  font-size: 10px;
}
.kb-file-chip .kb-file-icon {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input, #F9FAFB);
  font-size: 18px;
  flex-shrink: 0;
}
.kb-create .kb-apply { height: 40px; padding: 0 22px; font-size: 13px; margin-left: auto; }

.kb-modal {
  display: none;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15,23,42,0.55);
  z-index: 4000;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.kb-modal.is-open { display: flex !important; }
.kb-modal-card {
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(15,23,42,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.kb-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light, #F3F4F6);
}
.kb-modal-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.kb-modal textarea.form-control { height: auto; min-height: 84px; padding: 10px 12px; line-height: 1.5; }
.kb-modal-foot { padding: 12px 18px; border-top: 1px solid var(--border-light, #F3F4F6); }
.kb-modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 14px 0 8px;
}
.kb-del {
  height: 40px;
  border: 1px solid #FECACA;
  background: #FEF2F2;
  color: #DC2626;
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.kb-del:hover { background: #FEE2E2; }

@media (max-width: 1100px) {
  .kb-weeks { grid-template-columns: 1fr; }
  .kb-board { grid-template-columns: 1fr !important; }
}
@media (max-width: 900px) {
  .kb-board { grid-template-columns: 1fr !important; }
  .kb-create-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .kb-create-grid { grid-template-columns: 1fr; }
}

[data-theme="dark"] .kb-card-project {
  border-color: #F472B6;
  background: rgba(244, 114, 182, 0.12);
  box-shadow: 0 0 0 1px rgba(251, 207, 232, 0.28);
}
[data-theme="dark"] .kb-card-project:hover {
  border-color: #F9A8D4;
  box-shadow: 0 4px 14px rgba(244, 114, 182, 0.22);
}
[data-theme="dark"] .kb-chip.danger {
  color: #F87171;
  background: rgba(248, 113, 113, 0.12);
  border-color: transparent;
}
[data-theme="dark"] .kb-editor .ql-snow .ql-stroke { stroke: #94A3B8; }
[data-theme="dark"] .kb-editor .ql-snow .ql-fill { fill: #94A3B8; }
[data-theme="dark"] .kb-editor .ql-editor { color: var(--text-primary); }
[data-theme="dark"] .kb-del {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.12);
  color: #F87171;
}
[data-theme="dark"] .kb-col {
  background: var(--bg-card);
  border-color: var(--border);
}
[data-theme="dark"] .kanban-lane {
  background: var(--bg-input) !important;
}
[data-theme="dark"] .kb-card:hover {
  box-shadow: var(--shadow-md);
}
