/* 1.2.87 - rich text task description editor */
.rich-editor {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  overflow: hidden;
}

.rich-editor:focus-within {
  border-color: rgba(96,165,250,.32);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(96,165,250,.08);
}

.rich-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.025);
}

.rich-editor-btn {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--separator-color);
  border-radius: 9px;
  background: rgba(255,255,255,.04);
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1;
}

.rich-editor-btn:hover,
.rich-editor-btn:focus-visible {
  outline: none;
  color: var(--text);
  background: rgba(255,255,255,.075);
  border-color: var(--separator-color);
}

.rich-editor-separator {
  width: 1px;
  height: 22px;
  margin: 0 3px;
  background: var(--separator-color);
}

.rich-editor-area {
  width: 100%;
  min-width: 0;
  min-height: 190px;
  max-height: min(48vh, 520px);
  overflow: auto;
  padding: 13px 14px;
  box-sizing: border-box;
  color: var(--text);
  line-height: 1.55;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  outline: none;
}

.rich-editor-area > * {
  max-width: 100%;
  word-break: normal;
  overflow-wrap: break-word;
}

.rich-editor-area.is-empty::before {
  content: attr(data-placeholder);
  color: var(--muted-2);
  pointer-events: none;
}

.rich-editor-source {
  display: none !important;
}

.rich-editor.is-invalid,
.rich-editor-area.is-invalid {
  border-color: rgba(255,255,255,.22) !important;
  box-shadow: 0 0 0 3px rgba(255,255,255,.08);
}

.rich-content p,
.rich-editor-area p {
  margin: 0 0 .75em;
}

.rich-content p:last-child,
.rich-editor-area p:last-child {
  margin-bottom: 0;
}

.rich-content ul,
.rich-content ol,
.rich-editor-area ul,
.rich-editor-area ol {
  margin: .55em 0 .75em 1.35em;
  padding: 0;
}

.rich-content li,
.rich-editor-area li {
  margin: .2em 0;
}

.rich-content a,
.rich-editor-area a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rich-content blockquote,
.rich-editor-area blockquote {
  margin: .8em 0;
  padding: .05em 0 .05em .85em;
  border-left: 2px solid var(--separator-color);
  color: var(--text-soft);
}

.rich-content pre,
.rich-editor-area pre {
  white-space: pre-wrap;
  margin: .75em 0;
  padding: .75em;
  border-radius: 10px;
  background: rgba(0,0,0,.22);
  overflow: auto;
}

.rich-content table,
.rich-editor-area table {
  width: 100%;
  border-collapse: collapse;
  margin: .75em 0;
  font-size: .95em;
}

.rich-content th,
.rich-content td,
.rich-editor-area th,
.rich-editor-area td {
  border: 1px solid var(--separator-color);
  padding: .45em .55em;
  text-align: left;
  vertical-align: top;
}



/* 1.2.90 - horizontal board scroll also works when cursor is over a column */
#view-tasks .tasks-board-wrap {
  overscroll-behavior-x: contain;
  scroll-behavior: auto;
}

#view-tasks .tasks-board {
  touch-action: pan-x pan-y;
}

/* 1.2.91 - task multi-select and context delete restore */
.task-card {
  padding-left: 42px;
}

.task-card-select-wrap {
  position: absolute;
  top: 13px;
  left: 13px;
  z-index: 4;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.task-card-select {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.task-card-select-wrap > span {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: rgba(255,255,255,.045);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
  transition: background .16s ease, box-shadow .16s ease, transform .16s ease;
}

.task-card-select-wrap:hover > span,
.task-card-select:focus-visible + span {
  background: rgba(255,255,255,.085);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.26), 0 0 0 3px rgba(255,255,255,.045);
}

.task-card-select:checked + span {
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12), 0 0 0 3px rgba(221,241,96,.10);
}

.task-card-select:checked + span::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: solid #111;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task-card--selected {
  background: #232323 !important;
  box-shadow: 0 12px 32px rgba(0,0,0,.28), 0 0 0 1px rgba(221,241,96,.24), inset 0 0 0 1px rgba(255,255,255,.055);
}

.task-card.is-dragging-related {
  opacity: .42;
  transform: scale(.985);
}

/* HOTFIX 5: wariant danger menu jest wspólny (.app-context-menu-item--danger). */
/* 1.2.93 - multi-select with blue left border */
.task-card {
  padding-left: 13px;
}

.task-card-select-wrap,
.task-card-select {
  display: none !important;
}

.task-card--selected {
  background: #232323 !important;
  box-shadow: 0 12px 32px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.065) !important;
}

.task-card--selected::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 4px 0 0 rgba(63,123,199,.92), inset 0 0 0 1px rgba(63,123,199,.22) !important;
}

.status-new {
  color: #D8E7FA;
  background: rgba(63,123,199,.16);
  box-shadow: inset 0 0 0 1px rgba(63,123,199,.22);
}

.status-email {
  color: #F1F8C9;
  background: rgba(221,241,96,.14);
  box-shadow: inset 0 0 0 1px rgba(221,241,96,.18);
}

.status-planned {
  color: #DCE7F8;
  background: rgba(96,165,250,.14);
  box-shadow: inset 0 0 0 1px rgba(96,165,250,.18);
}

.status-in_progress {
  color: #DDF5E2;
  background: rgba(79,184,107,.17);
  box-shadow: inset 0 0 0 1px rgba(79,184,107,.22);
}

.status-pending {
  color: #F5E9BF;
  background: rgba(216,185,76,.17);
  box-shadow: inset 0 0 0 1px rgba(216,185,76,.22);
}

.status-paused {
  color: #E6DEF8;
  background: rgba(141,103,228,.16);
  box-shadow: inset 0 0 0 1px rgba(141,103,228,.22);
}

.status-completed,
.status-accepted {
  color: #D6F1E3;
  background: rgba(53,172,112,.15);
  box-shadow: inset 0 0 0 1px rgba(53,172,112,.20);
}

.status-overdue,
.status-danger,
.status-rejected {
  color: #F5D4CF;
  background: rgba(217,85,69,.18);
  box-shadow: inset 0 0 0 1px rgba(217,85,69,.24);
}
.task-budget-pill {
  color: #DDF5E2;
  background: rgba(79,184,107,.16);
  box-shadow: inset 0 0 0 1px rgba(79,184,107,.20);
}

/* v1.2.101 - analiza: taski klienta jako lista w stylu wpisów */
.task-summary-rows {
  gap: 8px;
}

.task-summary-row {
  position: relative;
  align-items: flex-start;
}

.task-summary-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: rgba(255,255,255,.14);
}

.task-summary-row.has-budget::before {
  background: rgba(90, 168, 255, .85);
}

.task-summary-row.no-budget::before {
  background: rgba(255,255,255,.16);
}

.task-summary-row.is-near-budget::before {
  background: rgba(90, 168, 255, .95);
}

.task-summary-row.is-over-budget::before {
  background: rgba(255, 116, 116, .9);
}

.task-summary-row .row-main {
  padding-left: 6px;
}

.task-summary-billing {
  color: var(--text-soft);
}

.task-summary-data {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 5px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.task-summary-data span + span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 720px) {
  .task-summary-row {
    flex-direction: column;
  }

  .task-summary-data {
    justify-items: start;
    white-space: normal;
  }
}

.analysis-list-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--separator-color);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.inline-filter-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.inline-filter-toggle:has(input:checked) {
  color: var(--text);
  border-color: rgba(113,179,255,.45);
  background: rgba(113,179,255,.12);
}

@media (max-width: 720px) {
  .analysis-list-tools,
  .analysis-list-tools .search {
    width: 100%;
  }
}


/* v1.2.102 - harmonogram tasków: przedział Od-Do */
.task-schedule-grid {
  display: grid;
  grid-template-columns: minmax(170px, 1.25fr) minmax(170px, 1fr) repeat(2, minmax(105px, .65fr));
  gap: 10px;
  align-items: end;
}

.task-schedule-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.task-schedule-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}

.task-schedule-helper {
  margin-top: -4px;
}

@media (max-width: 720px) {
  .task-schedule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-schedule-field--date,
  .task-schedule-grid .task-schedule-field:nth-child(2) {
    grid-column: 1 / -1;
  }
}

/* v1.4.0 - operacje zbiorcze, kolumny, alerty czasu i czyszczenie bazy */
.bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.bulk-actions[hidden] { display: none !important; }
.bulk-actions__count {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 600;
}

.task-columns-editor { display: grid; gap: 10px; }
.task-column-editor-row {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(180px, 1.4fr) minmax(145px, .7fr) minmax(145px, .7fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel-soft);
  transition: transform .16s ease, border-color .16s ease, background .16s ease, opacity .16s ease;
}
.task-column-editor-row.is-dragging { opacity: .42; }
.task-column-editor-row.is-drop-before::before,
.task-column-editor-row.is-drop-after::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  height: 3px;
  z-index: 3;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.task-column-editor-row.is-drop-before::before { top: -7px; }
.task-column-editor-row.is-drop-after::after { bottom: -7px; }
.task-column-editor-row__handle {
  width: 30px;
  height: 42px;
  align-self: center;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted-2);
  cursor: grab;
  touch-action: none;
}
.task-column-editor-row__handle:hover,
.task-column-editor-row__handle:focus-visible {
  color: var(--accent-strong);
  background: var(--accent-soft);
  outline: none;
}
.task-column-editor-row__handle:active { cursor: grabbing; }
.task-column-editor-row__handle svg { width: 18px; height: 18px; }
.task-column-editor-row__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.task-column-editor-row__actions .btn {
  min-width: 40px;
  padding-inline: 10px;
}
.task-column-editor-row__role {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}


.database-cleanup-section { border-color: rgba(255, 110, 110, .18); }
.database-cleanup-grid {
  display: grid;
  gap: 0;
}
.database-cleanup-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border: 0;
  border-top: 1px solid var(--separator-color);
  border-radius: 0;
  background: transparent;
}
.database-cleanup-item:first-child {
  border-top: 0;
}
.database-cleanup-item > div {
  display: grid;
  gap: 4px;
}
.database-cleanup-item strong { font-size: 14px; }
.database-cleanup-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.database-cleanup-item .btn { white-space: nowrap; }

@media (max-width: 900px) {
  .task-column-editor-row { grid-template-columns: 30px minmax(0, 1fr); }
  .task-column-editor-row__type,
  .task-column-editor__weekday,
  .task-column-editor-row__actions { grid-column: 2; }
  .bulk-actions { justify-content: flex-start; }
}

@media (max-width: 720px) {
  .database-cleanup-item { grid-template-columns: 1fr; }
  .database-cleanup-item .btn { width: 100%; }
}

