/* Marginalia Tasks — [marginalia-ai-tasks-v1] */

.tasks-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 0 5rem;
}

.tasks-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.tasks-toolbar .form-input { width: auto; min-width: 150px; }
.tasks-list-select { min-width: 220px !important; max-width: 360px; }
.tasks-spacer { flex: 1 1 auto; }

.tasks-filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0.9rem;
  margin-bottom: 1rem;
  background: rgba(240, 237, 228, 0.025);
  border: 1px solid rgba(240, 237, 228, 0.07);
  border-radius: 12px;
}
.tasks-filter-panel.hidden { display: none; }
.tasks-filter-field label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(240, 237, 228, 0.42);
}
.tasks-filter-field .form-input { width: 100%; }

.tasks-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin: 0 0 0.9rem;
  color: rgba(240, 237, 228, 0.48);
  font-size: 0.82rem;
}

.task-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  margin-bottom: 0.55rem;
  background: #1C1A18;
  border: 1px solid rgba(240, 237, 228, 0.07);
  border-radius: 12px;
  transition: border-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}
.task-card:hover { border-color: rgba(240, 237, 228, 0.14); transform: translateY(-1px); }
.task-card.is-done { opacity: 0.55; }
.task-card.is-done .task-title { text-decoration: line-through; }
.task-check {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: #D9A574;
  cursor: pointer;
}
.task-title { font-weight: 650; font-size: 0.96rem; color: #F0EDE4; line-height: 1.35; }
.task-description { margin-top: 0.25rem; color: rgba(240, 237, 228, 0.58); font-size: 0.82rem; line-height: 1.45; white-space: pre-wrap; }
.task-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.55rem; }
.task-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.67rem;
  color: rgba(240, 237, 228, 0.63);
  background: rgba(240, 237, 228, 0.05);
  border: 1px solid rgba(240, 237, 228, 0.06);
}
.task-pill.urgent { color: #e4a6a6; border-color: rgba(220, 80, 80, 0.25); }
.task-pill.important { color: #D9A574; border-color: rgba(217, 165, 116, 0.25); }
.task-source-btn {
  border: 0;
  background: transparent;
  color: #D9A574;
  padding: 0;
  cursor: pointer;
  font: inherit;
}
.task-source-btn:hover { text-decoration: underline; }
.task-actions { display: flex; gap: 0.25rem; }

.tasks-empty {
  border: 1px dashed rgba(240, 237, 228, 0.12);
  border-radius: 14px;
  padding: 3rem 1rem;
  text-align: center;
  color: rgba(240, 237, 228, 0.5);
}
.tasks-empty h2 { color: rgba(240, 237, 228, 0.82); font-family: 'Fraunces', serif; font-size: 1.25rem; margin-bottom: 0.35rem; }

.task-generation-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.task-generation-stat {
  background: rgba(240, 237, 228, 0.04);
  border: 1px solid rgba(240, 237, 228, 0.07);
  border-radius: 10px;
  padding: 0.7rem;
}
.task-generation-stat b { display: block; font-family: 'Fraunces', serif; font-size: 1.35rem; }
.task-generation-stat span { font-size: 0.7rem; color: rgba(240, 237, 228, 0.45); }
.task-preview-list { display: flex; flex-direction: column; gap: 0.45rem; max-height: 52vh; overflow: auto; padding-right: 0.2rem; }
.task-preview-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  padding: 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(240, 237, 228, 0.07);
  background: rgba(240, 237, 228, 0.025);
}
.task-preview-row input { margin-top: 3px; accent-color: #D9A574; }

.ai-settings-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 0.75rem;
  width: min(100%, 520px);
}
.ai-settings-actions { display: flex; gap: 0.55rem; flex-wrap: wrap; margin-top: 0.75rem; }

@media (max-width: 820px) {
  .tasks-filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .tasks-page { padding-top: 1rem; }
  .tasks-filter-panel { grid-template-columns: 1fr; }
  .tasks-toolbar { align-items: stretch; }
  .tasks-toolbar > * { width: 100%; }
  .tasks-toolbar .form-input { width: 100%; }
  .tasks-spacer { display: none; }
  .task-card { grid-template-columns: auto minmax(0, 1fr); }
  .task-actions { grid-column: 2; justify-content: flex-end; }
  .task-generation-summary { grid-template-columns: 1fr; }
  .ai-settings-grid { grid-template-columns: 1fr; }
}

/* [marginalia-task-ux-v1] */
/* Task controls + completed-task discoverability.
   `color-scheme: dark` is important for the native Windows/Chromium popup:
   without it the <select> popup can be white while inheriting Marginalia's
   light text color, making the options nearly invisible. */
.tasks-page select.form-input {
  color-scheme: dark;
  background-color: #1C1A18;
  color: #F0EDE4;
  border-color: rgba(240, 237, 228, 0.12);
}
.tasks-page select.form-input option,
.tasks-page select.form-input optgroup {
  background-color: #1C1A18;
  color: #F0EDE4;
}
.tasks-page select.form-input option:checked {
  background-color: #3A3027;
  color: #F0EDE4;
}

.tasks-summary-bar {
  justify-content: space-between;
  gap: 0.8rem 1rem;
}

.tasks-status-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(240, 237, 228, 0.08);
  border-radius: 10px;
  background: rgba(240, 237, 228, 0.025);
}

.tasks-status-tab {
  appearance: none;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(240, 237, 228, 0.56);
  padding: 6px 10px;
  min-height: 30px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.tasks-status-tab:hover {
  background: rgba(240, 237, 228, 0.06);
  color: #F0EDE4;
}
.tasks-status-tab:active { transform: scale(0.97); }
.tasks-status-tab.active {
  background: rgba(217, 165, 116, 0.15);
  color: #D9A574;
  box-shadow: inset 0 0 0 1px rgba(217, 165, 116, 0.22);
}
.tasks-status-tab:focus-visible {
  outline: 2px solid rgba(217, 165, 116, 0.55);
  outline-offset: 2px;
}

.tasks-summary-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.task-check:disabled {
  cursor: wait;
  opacity: 0.65;
}

@media (max-width: 560px) {
  .tasks-summary-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .tasks-status-tabs {
    width: 100%;
  }
  .tasks-status-tab {
    flex: 1 1 0;
  }
  .tasks-summary-meta {
    margin-left: 0;
  }
}
