/*
 * Partstall Tracker — disainisüsteem.
 * Tokenid ja komponendiklassid, mida hilisemad taskid (tahvel, nimekiri,
 * taski detail, admin) kasutavad ilma muutmata. Vt disainispec
 * docs/superpowers/specs/2026-07-23-task-tracker-design.md p.4/p.7.
 */

/* ---------- Tokenid ---------- */
:root {
  --primary: #D24508;
  --primary-soft: #FDEEE7;
  --primary-dark: #A42E04;
  --bg: #FAFAFA;
  --border: #F2F3F5;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --white: #FFFFFF;
  --text: #1A1A1A;
  --text-muted: #6B7280;
  --text-faint: #9CA3AF;

  --shadow-card: 0 1px 2px rgba(17, 17, 17, 0.04);
  --shadow-hover: 0 4px 14px rgba(17, 17, 17, 0.08);

  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-heading: 'Manrope', system-ui, -apple-system, sans-serif;

  /* Ohu-/hoiatustoon (nt möödunud tähtaeg) — sama punane mis kriitilisel */
  --danger: #B91C1C;

  /* Sildid (badge/prio/status) — heledad taustad + kontrastne tekst */
  --bug-bg: #FEE2E2;
  --bug-text: #B91C1C;
  --arendus-bg: #DBEAFE;
  --arendus-text: #1D4ED8;

  --prio-kriitiline-bg: #FEE2E2;
  --prio-kriitiline-text: #B91C1C;
  --prio-korge-bg: var(--primary-soft);
  --prio-korge-text: var(--primary-dark);
  --prio-keskmine-bg: #EEF2F6;
  --prio-keskmine-text: #475569;
  --prio-madal-bg: #F3F4F6;
  --prio-madal-text: #9CA3AF;

  --status-uus-bg: #EEF2F6;
  --status-uus-text: #475569;
  --status-toos-bg: #FEF3C7;
  --status-toos-text: #92400E;
  --status-testimisel-bg: #EDE9FE;
  --status-testimisel-text: #5B21B6;
  --status-valmis-bg: #DCFCE7;
  --status-valmis-text: #166534;
  --status-ei_paranda-bg: #F3F4F6;
  --status-ei_paranda-text: #6B7280;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.5em;
  color: var(--text);
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ---------- Layout ---------- */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}
.main-centered {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  max-width: none;
}
.footer {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.8rem;
  padding: 24px 20px 40px;
}

/* ---------- Nav ---------- */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}
.nav-logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}
.nav-logo:hover { text-decoration: none; color: var(--primary); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.nav-link {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.nav-link:hover {
  color: var(--text);
  background: var(--bg);
  text-decoration: none;
}
.nav-link.active {
  color: var(--primary-dark);
  background: var(--primary-soft);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  white-space: nowrap;
}
.nav-user-name {
  font-weight: 500;
  color: var(--text);
}
.nav-logout {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.nav-logout:hover { color: var(--primary-dark); }

/* ---------- Card ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover {
  text-decoration: none;
  background: var(--bg);
}
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: var(--white);
}
.btn-secondary {
  background: var(--primary-soft);
  border-color: var(--primary-soft);
  color: var(--primary-dark);
}
.btn-secondary:hover {
  background: var(--primary-soft);
  filter: brightness(0.97);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- Form fields ---------- */
.field {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}
.field input,
.field select,
.field textarea {
  font-family: var(--font-body);
  font-size: 0.925rem;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field textarea { resize: vertical; min-height: 120px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.badge-bug { background: var(--bug-bg); color: var(--bug-text); }
.badge-arendus { background: var(--arendus-bg); color: var(--arendus-text); }

/* Prioriteet */
.prio-kriitiline { background: var(--prio-kriitiline-bg); color: var(--prio-kriitiline-text); }
.prio-korge { background: var(--prio-korge-bg); color: var(--prio-korge-text); }
.prio-keskmine { background: var(--prio-keskmine-bg); color: var(--prio-keskmine-text); }
.prio-madal { background: var(--prio-madal-bg); color: var(--prio-madal-text); }

/* Staatus */
.status-uus { background: var(--status-uus-bg); color: var(--status-uus-text); }
.status-toos { background: var(--status-toos-bg); color: var(--status-toos-text); }
.status-testimisel { background: var(--status-testimisel-bg); color: var(--status-testimisel-text); }
.status-valmis { background: var(--status-valmis-bg); color: var(--status-valmis-text); }
.status-ei_paranda { background: var(--status-ei_paranda-bg); color: var(--status-ei_paranda-text); }

/* ---------- Lehe päis + filtririba ---------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.page-header .page-title { margin-bottom: 0; }

.filters {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filters-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  flex: 1 1 auto;
}
.filters-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filters-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-faint);
}
.filters-field select,
.filters-field input {
  font-family: var(--font-body);
  font-size: 0.875rem;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
}
.filters-field select:focus,
.filters-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.filters-field-search { flex: 1 1 200px; }
.filters-field-search input { width: 100%; }
.filters .btn { align-self: flex-end; }

/* ---------- Board / Kanban ---------- */
.board {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.column {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex: 1 1 260px;
  min-width: 260px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 4px 4px 8px;
}
.column-count {
  color: var(--text-faint);
  font-weight: 500;
}
.column-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 40px;
}

.task-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: grab;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.task-card:hover {
  box-shadow: var(--shadow-hover);
  text-decoration: none;
}
.task-card.dragging {
  opacity: 0.6;
  cursor: grabbing;
}
.task-card-key {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-faint);
}
.task-card-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}
.task-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.task-card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.task-card-assignee {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.task-card-title { text-decoration: none; }
.task-card-title:hover { text-decoration: underline; }

/* Täitja initsiaalide ring (või kriips kui määramata). */
.assignee-circle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}
.assignee-circle.assignee-none {
  background: var(--bg);
  color: var(--text-faint);
  border: 1px solid var(--border);
}

/* Veerg, mille kohal parasjagu kaarti lohistatakse. */
.column.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

/* Sildid kaardil värvitäppidena (title=nimi hoveril). */
.task-card-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.task-card-label-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Kaardi jalus: täitja nimi vasakul, loendurid + tähtaeg paremal. */
.task-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
}
.task-card-assignee {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-card-assignee-none {
  color: var(--text-faint);
}
.task-card-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: var(--text-muted);
}
.task-card-count {
  white-space: nowrap;
}
.task-card-due {
  white-space: nowrap;
  font-weight: 600;
}
/* Möödunud tähtaeg (ja task pole valmis) — punane. */
.task-card-due-overdue {
  color: var(--danger);
}
/* "lõpetas: X" rida ainult Valmis-veeru kaartidel. */
.task-card-completer {
  font-size: 0.72rem;
  color: var(--text-faint);
}

/* Kiirloomine veeru all. */
.quick-add {
  margin-top: 2px;
}
.quick-add-toggle {
  width: 100%;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.quick-add-toggle:hover {
  background: var(--white);
  color: var(--primary-dark);
  border-color: var(--primary);
}
.quick-add-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
}
.quick-add-form[hidden] {
  display: none;
}
.quick-add-title,
.quick-add-project {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--white);
  color: var(--text);
}
.quick-add-title:focus,
.quick-add-project:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.quick-add-submit {
  align-self: flex-start;
}

/* ---------- Sidebar (taski detailvaade) ---------- */
.sidebar {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidebar-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-faint);
}

/* ---------- Autentimine ---------- */
.auth-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.auth-logo {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
  margin-bottom: 12px;
}
.auth-error {
  background: var(--prio-kriitiline-bg);
  color: var(--prio-kriitiline-text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.85rem;
  margin: 4px 0 12px;
}
.auth-submit { width: 100%; margin-top: 6px; }

/* ---------- Mobiil (≤768px) ---------- */
@media (max-width: 768px) {
  .nav-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    gap: 10px;
  }
  .nav-links {
    order: 3;
    width: 100%;
    flex-wrap: wrap;
    gap: 2px;
  }
  .nav-actions {
    margin-left: auto;
    gap: 10px;
  }
  .nav-user-name { display: none; }

  .main { padding: 16px 14px 48px; }

  .board {
    flex-direction: column;
    overflow-x: visible;
  }
  .column {
    min-width: 0;
    width: 100%;
  }
  /* NB: .task-detail-body virnastamine on failis allpool (task-detail-body
     baasreegel defineeritakse hiljem, seega override peab tulema pärast seda). */
}

/* ---------- Vorm + detailvaade (Task 6) ---------- */
.page-narrow { max-width: 640px; margin: 0 auto; }
.page-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  margin-bottom: 16px;
}
.text-muted { color: var(--text-muted); }

.form-error {
  background: var(--prio-kriitiline-bg);
  color: var(--prio-kriitiline-text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 120px;
  background: var(--white);
  font-size: 0.9rem;
  line-height: 1.5;
}
.editor:focus {
  outline: none;
  border-color: var(--primary);
}

.task-detail-header { margin-bottom: 20px; }
.task-detail-key {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--primary);
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.task-detail-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin-bottom: 10px;
}
.task-detail-badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* Pealkirja rida + inline-muutmine */
.title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.title-row .task-detail-title { margin-bottom: 0; }
.icon-btn {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  font-size: 0.85rem;
  cursor: pointer;
  flex: 0 0 auto;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.title-edit { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.title-input {
  flex: 1 1 220px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 1.1rem;
}
.title-input:focus { outline: none; border-color: var(--primary); }

/* Küljepaneeli select-id */
.sidebar-select {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  width: 100%;
  cursor: pointer;
}
.sidebar-select:focus { outline: none; border-color: var(--primary); }
.sidebar-select:disabled { opacity: 0.6; cursor: wait; }

/* "Salvestatud ✓" vilksatus */
.save-flash {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--status-valmis-bg);
  color: var(--status-valmis-text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-hover);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 50;
}
.save-flash.show { opacity: 1; transform: translateY(0); }

/* Kommentaarid + ajalugu */
.task-detail-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.section-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  margin: 0 0 12px;
}
.comment {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.comment-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.comment-author { font-weight: 600; font-size: 0.85rem; }
.comment-time { font-size: 0.75rem; color: var(--text-faint); }
.comment-body { font-size: 0.9rem; line-height: 1.5; }
.comment-body img { max-width: 100%; height: auto; }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.comment-form .btn { align-self: flex-start; }

.history-list { list-style: none; margin: 0; padding: 0; }
.history-item {
  font-size: 0.85rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }
.history-time { color: var(--text-faint); font-size: 0.8rem; }

.task-detail-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}
.task-detail-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  word-break: break-word;
}
.task-detail-desc img { max-width: 100%; height: auto; }

/* --- Editor-tööriistariba + kleebitud pildid (Task 8) --- */
.editor img, .editor-img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.comment-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.editor-toolbar { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.editor-hint { color: var(--text-muted); font-size: 0.8rem; }

/* --- Manuste galerii (Task 8) --- */
.attachments-section { margin-bottom: 24px; }
.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.attachment {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  overflow: hidden;
}
.attachment-thumb { display: block; aspect-ratio: 1 / 1; }
.attachment-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attachment-video { width: 100%; display: block; background: #000; max-height: 220px; }
.attachment-file {
  display: flex; align-items: center; gap: 8px; padding: 12px;
  color: var(--primary-dark); font-size: 0.85rem; word-break: break-all;
}
.attachment-file-icon { font-size: 1.4rem; }
.attachment-del {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px; line-height: 1;
  border: none; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.attachment-del:hover { background: rgba(0,0,0,0.8); }

/* ---------- Nimekirjavaade (Task 10) ---------- */
.list-table-wrap {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.list-table th,
.list-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.list-table th {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-faint);
}
.list-table th a {
  color: inherit;
  text-decoration: none;
}
.list-table th a:hover { color: var(--text); text-decoration: underline; }
.list-table tbody tr:last-child td { border-bottom: none; }
.list-table tbody tr:hover td { background: var(--bg); }
.list-table-key {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-faint);
}
.list-table-title {
  color: var(--text);
  font-weight: 600;
  white-space: normal;
}
.list-table-title:hover { color: var(--primary); text-decoration: underline; }
.list-table-muted { color: var(--text-muted); }
.list-table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 14px;
  white-space: normal;
}

/* ---------- Mobiil (≤768px): failis hiljem defineeritud komponendid ----------
   Peab paiknema pärast .task-detail-body baasreeglit (grid 1fr 280px), muidu
   võrdse spetsiifilisuse tõttu võidaks baasreegel allika-järjekorra alusel ja
   küljepaneel jääks mobiilis 280px kõrvale, surudes põhisisu ribaks kokku. */
@media (max-width: 768px) {
  .task-detail-body {
    grid-template-columns: 1fr;
  }
}

/* ---------- Task 4: AI-väljavõtte modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 12px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head .section-title { margin: 0; }
.modal-textarea {
  width: 100%;
  min-height: 320px;
  flex: 1 1 auto;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
.modal-textarea:focus { outline: none; border-color: var(--primary); }
.modal-actions { display: flex; align-items: center; gap: 10px; }
.export-copied { color: var(--status-valmis-text); font-size: 0.85rem; font-weight: 600; }

/* ---------- Task 4: Kommentaari muutmine/kustutamine ---------- */
.comment-edited { font-size: 0.75rem; color: var(--text-faint); font-style: italic; }
.comment-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.comment:hover .comment-actions,
.comment:focus-within .comment-actions { opacity: 1; }
.comment-edit,
.comment-delete {
  border: none;
  background: none;
  padding: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
}
.comment-edit:hover { color: var(--primary); }
.comment-delete:hover { color: var(--danger); }
.comment-edit-box { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
/* Puuteseadmetes pole hover'it — näita nupud alati. */
@media (hover: none) {
  .comment-actions { opacity: 1; }
}

/* ---------- Task 4: Demo-manus (html) ---------- */
.attachment-demo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
}
.attachment-demo-icon { font-size: 1.6rem; }
.attachment-demo-name {
  font-size: 0.82rem;
  color: var(--text);
  word-break: break-all;
}

/* ---------- Task 4: Tähtaeg (küljepaneel) ---------- */
.due-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.due-input {
  flex: 1 1 140px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
}
.due-input:focus { outline: none; border-color: var(--primary); }
.due-input.due-overdue { color: var(--danger); border-color: var(--danger); font-weight: 600; }

/* ---------- Task 4: Sildid (küljepaneel) ---------- */
.labels-block { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.label-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}
.label-chip-name { white-space: nowrap; }
.label-chip-remove {
  border: none;
  background: none;
  color: #fff;
  padding: 0;
  margin-left: 2px;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
}
.label-chip-remove:hover { opacity: 1; }
.label-add {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.label-name-input {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.label-name-input:focus { outline: none; border-color: var(--primary); }
.label-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.label-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.label-color-swatch.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--white) inset; }
.label-add-actions { display: flex; gap: 8px; }
.label-add-btn { align-self: flex-start; }

/* ---------- Task 4: Nimekirja uued veerud (Tähtaeg, Sildid, loendurid) ---------- */
.list-table-metrics { margin-left: 8px; white-space: nowrap; font-size: 0.8rem; color: var(--text-muted); }
.list-table-count { margin-left: 6px; }
.list-table-due { font-weight: 600; }
.list-table-due-overdue { color: var(--danger); }
.list-table-labels { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.list-label-chip {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Task 4: Admin siltide värvi-swatch ---------- */
.label-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 6px;
  border: 1px solid var(--border);
}

/* ---------- Task 4: Tegevusvoog (ajajoon) ---------- */
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-item {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-time { color: var(--text-faint); font-size: 0.8rem; white-space: nowrap; min-width: 118px; }
.activity-user { font-weight: 600; }
.activity-text { color: var(--text-muted); }
.activity-key {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
}
