/* ============================================================================
   ANUBYTE Tasks — page styles (team task organiser).
   Uses the design-system tokens from style.css (:root). Every class here is
   prefixed `tk-` so nothing collides with the rest of the app.
============================================================================ */

/* author `display:` rules would otherwise defeat the [hidden] attribute */
.tk-stats[hidden], .tk-filters[hidden], #tk-new[hidden] { display: none !important; }

.tk-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---- view switcher + segmented controls --------------------------------- */
.tk-seg {
  display: inline-flex; gap: 2px; padding: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  background: var(--surface-sunken); border: 1px solid var(--hairline); border-radius: var(--r-pill);
}
.tk-seg::-webkit-scrollbar { display: none; }
.tk-seg button {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  padding: 8px 14px; border-radius: var(--r-pill); transition: all var(--dur) var(--ease-out);
}
.tk-seg button:hover { color: var(--text); }
.tk-seg button[aria-current="page"], .tk-seg button[aria-pressed="true"] {
  color: var(--text-strong); background: linear-gradient(135deg, rgba(200,31,240,.22), rgba(107,61,245,.22));
  box-shadow: inset 0 0 0 1px rgba(200,31,240,.35);
}
.tk-count {
  font-family: var(--font-mono); font-size: 10px; min-width: 18px; padding: 1px 6px; text-align: center;
  border-radius: var(--r-pill); background: rgba(255,255,255,.08); color: var(--text-secondary);
}
.tk-count.alert { background: var(--danger); color: #fff; }

.tk-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.tk-filters .search-box { flex: 1 1 240px; max-width: 360px; }
.tk-filters select {
  font-family: var(--font-sans); font-size: 13px; color: var(--text); padding: 9px 12px;
  background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r-control); outline: none;
}
.tk-filters select:focus { border-color: var(--neon-cyan); }

.tk-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.tk-stat {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 8px 14px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--hairline); color: var(--text-muted);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
}
.tk-stat b { font-family: var(--font-display); font-size: 18px; color: var(--neon-cyan); letter-spacing: 0; }
.tk-stat.alert { border-color: rgba(255,77,109,.4); background: var(--danger-bg); color: var(--danger); }
.tk-stat.alert b { color: var(--danger); }

.tk-label { margin: 6px 0 10px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }

/* ---- task rows ------------------------------------------------------------ */
.tk-rows { display: grid; gap: 8px; }
.tk-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; width: 100%;
  padding: 13px 16px; text-align: start; cursor: pointer; color: inherit; font: inherit;
  background: var(--surface); border: 1px solid var(--hairline); border-inline-start: 3px solid var(--border-strong);
  border-radius: var(--r-md); transition: all var(--dur) var(--ease-out);
}
.tk-row:hover { background: var(--surface-raised); border-inline-start-color: var(--neon-cyan); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.tk-row.is-overdue, .tk-row.is-urgent, .tk-card.is-overdue, .tk-card.is-urgent { border-inline-start-color: var(--danger); }
.tk-row.is-today, .tk-card.is-today { border-inline-start-color: var(--warning); }
.tk-row.is-sub { border-inline-start-color: var(--neon-violet); }
.tk-row-body { min-width: 0; display: grid; gap: 4px; }
.tk-row-title { display: flex; align-items: flex-start; gap: 8px; font-size: 14.5px; font-weight: 600; line-height: 1.35; color: var(--text-strong); }
.tk-row-title .t { overflow-wrap: anywhere; }
.tk-row-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; color: var(--text-muted); font-size: 12px; }
.tk-row-meta .dot { color: var(--border-strong); }
.tk-row-due { display: grid; justify-items: end; gap: 2px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.tk-row-due b { font-weight: 700; color: var(--text-secondary); }
.tk-row-due.overdue, .tk-row-due.overdue b { color: var(--danger); }
.tk-row-due.today, .tk-row-due.today b { color: var(--warning); }
.tk-chev { color: var(--border-strong); font-size: 20px; line-height: 1; }
.tk-row:hover .tk-chev { color: var(--neon-cyan); }
html.ar .tk-chev { transform: scaleX(-1); }

.tk-pill {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--r-pill); white-space: nowrap;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  background: rgba(255,255,255,.06); color: var(--text-secondary); border: 1px solid var(--hairline);
}
.tk-pill.assigned { background: var(--info-bg);    color: var(--info);        border-color: rgba(37,214,242,.3); }
.tk-pill.progress { background: rgba(107,61,245,.16); color: #b9a4ff;        border-color: rgba(107,61,245,.4); }
.tk-pill.review   { background: var(--warning-bg); color: var(--warning);     border-color: rgba(226,192,103,.35); }
.tk-pill.closed   { background: var(--success-bg); color: var(--success);     border-color: rgba(47,210,122,.3); }
.tk-pill.cancelled{ background: rgba(255,255,255,.04); color: var(--text-disabled); }
.tk-pill.off      { background: var(--danger-bg);  color: var(--danger);      border-color: rgba(255,77,109,.3); }
.tk-flag {
  display: inline-flex; padding: 2px 7px; border-radius: 5px; flex: 0 0 auto; margin-top: 1px;
  background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(255,77,109,.3);
  font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}

/* ---- board / cards --------------------------------------------------------- */
.tk-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.tk-col { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--r-lg); background: var(--surface-sunken); border: 1px solid var(--hairline); }
.tk-col-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 6px;
  font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-secondary); }
.tk-col-head span:last-child { font-family: var(--font-mono); color: var(--text-muted); }
.tk-col-empty { padding: 16px 6px; text-align: center; color: var(--text-disabled); font-size: 12.5px; }
.tk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.tk-card {
  display: grid; gap: 10px; padding: 14px; text-align: start; cursor: pointer; color: inherit; font: inherit;
  background: var(--surface); border: 1px solid var(--hairline); border-inline-start: 3px solid var(--border-strong);
  border-radius: var(--r-md); transition: all var(--dur) var(--ease-out);
}
.tk-card:hover { background: var(--surface-raised); border-inline-start-color: var(--neon-cyan); box-shadow: var(--shadow-2); }
.tk-card h3 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--text-strong); overflow-wrap: anywhere; }
.tk-card-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tk-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; color: var(--text-muted); font-size: 11.5px; }

.tk-empty { display: grid; place-items: center; gap: 6px; min-height: 220px; padding: 30px; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--r-lg); background: var(--surface-sunken); }
.tk-empty h3 { margin: 0; font-family: var(--font-display); font-size: 16px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-strong); }
.tk-empty p { margin: 0; color: var(--text-muted); font-size: 13.5px; max-width: 46ch; }

/* ---- team + guide ------------------------------------------------------------ */
.tk-who { display: flex; align-items: center; gap: 10px; }
.tk-who small { display: block; color: var(--text-muted); font-size: 11.5px; }
.tk-av { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  background: var(--grad-violet, linear-gradient(135deg,#C81FF0,#6B3DF5)); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 12px; }
tr.tk-inactive td { opacity: .55; }
.table-wrap th.num { text-align: right; }
.tk-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tk-matrix td.yes { color: var(--success); font-weight: 700; text-align: center; }
.tk-matrix td.no  { color: var(--text-disabled); text-align: center; }
.tk-matrix th.role { text-align: center; }
.tk-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.tk-toolbar p { margin: 0; color: var(--text-muted); font-size: 13px; max-width: 64ch; line-height: 1.6; }
.tk-h2 { margin: 30px 0 10px; font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-strong); }
.tk-areas { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tk-area-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border); font-size: 13px; }
.tk-area-chip.off { opacity: .5; text-decoration: line-through; }
.tk-area-chip button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 12px; text-decoration: underline; }
.tk-area-chip button:hover { color: var(--neon-cyan); }
.tk-prose { max-width: 70ch; padding: 26px 28px; border: 1px solid var(--hairline); border-radius: var(--r-card); background: var(--surface); }
.tk-prose h2 { margin: 26px 0 8px; font-family: var(--font-display); font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-strong); }
.tk-prose h2:first-child { margin-top: 0; }
.tk-prose p, .tk-prose li { color: var(--text-secondary); font-size: 14px; line-height: 1.7; }
.tk-prose ul, .tk-prose ol { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; }
.tk-prose b { color: var(--text-strong); }

/* ---- dialogs (native <dialog>: they sit above everything, incl. the toast) ---- */
dialog.tk-dlg {
  width: min(680px, calc(100vw - 20px)); max-height: min(880px, calc(100vh - 32px)); padding: 0; overflow: hidden;
  background: var(--surface); color: var(--text); border: 1px solid var(--hairline-strong); border-radius: var(--r-xl);
  box-shadow: var(--shadow-3), 0 0 60px rgba(107,61,245,.14);
}
dialog.tk-dlg[open] { display: flex; flex-direction: column; animation: modal-in .22s var(--ease-out); }
dialog.tk-dlg::backdrop { background: rgba(7,6,11,.78); backdrop-filter: blur(6px); }
.tk-dlg-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 26px 16px; border-bottom: 1px solid var(--hairline); }
.tk-eyebrow { margin: 0 0 4px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--neon-cyan); }
.tk-dlg-head h2 { margin: 0; font-family: var(--font-display); font-size: 19px; letter-spacing: .03em; line-height: 1.3; color: var(--text-strong); overflow-wrap: anywhere; }
.tk-sub { margin: 7px 0 0; color: var(--text-muted); font-size: 12px; }
.tk-x { flex: 0 0 auto; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--surface-raised); color: var(--text-secondary); font-size: 19px; cursor: pointer; }
.tk-x:hover { background: var(--surface-chip); color: var(--text-strong); }
.tk-dlg-body { flex: 1 1 auto; overflow-y: auto; padding: 20px 26px 24px; display: grid; gap: 18px; align-content: start; }
.tk-dlg-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 26px; border-top: 1px solid var(--hairline); background: var(--surface); }
.tk-dlg-foot p { margin: 0; color: var(--text-muted); font-size: 12.5px; }
.tk-btnrow { display: flex; gap: 8px; }

.tk-steps { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--surface-sunken); }
.tk-steps strong { font-family: var(--font-mono); font-size: 11px; font-weight: 400; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.tk-track { display: flex; gap: 4px; flex-wrap: wrap; }
.tk-track button {
  flex: 1 1 90px; min-height: 40px; padding: 7px 6px; cursor: pointer; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  transition: all var(--dur) var(--ease-out);
}
.tk-track button:disabled { opacity: .5; cursor: not-allowed; }
.tk-track button:not(:disabled):hover { border-color: var(--neon-cyan); color: var(--neon-cyan); }
.tk-track button[aria-current="step"] { background: var(--grad-neon); border-color: transparent; color: #fff; opacity: 1; box-shadow: var(--glow-magenta); }
.tk-steps small { color: var(--text-muted); font-size: 12px; line-height: 1.55; }

.tk-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--hairline); overflow: hidden; }
.tk-fact { padding: 11px 14px; background: var(--surface); }
.tk-fact span { display: block; margin-bottom: 3px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }
.tk-fact b { font-size: 13.5px; font-weight: 600; color: var(--text-strong); }
.tk-fact b.overdue { color: var(--danger); }
.tk-fact b.today { color: var(--warning); }
.tk-desc { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }

.tk-sec { display: grid; gap: 11px; }
.tk-sec-head h3 { margin: 0; font-family: var(--font-display); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-strong); }
.tk-sec-head h3 em { font-style: normal; color: var(--text-muted); font-weight: 400; margin-inline-start: 6px; }
.tk-subtask { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--hairline); border-inline-start: 3px solid var(--neon-violet); border-radius: var(--r-sm); background: var(--surface-sunken); flex-wrap: wrap; }
.tk-subtask.done { border-inline-start-color: var(--success); }
.tk-sub-body { flex: 1 1 160px; min-width: 0; display: grid; gap: 2px; }
.tk-sub-body strong { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; color: var(--text-strong); }
.tk-subtask.done .tk-sub-body strong { color: var(--text-muted); text-decoration: line-through; }
.tk-sub-body small { color: var(--text-muted); font-size: 11.5px; }
.tk-subtask select, .tk-inline select, .tk-inline input {
  font-family: var(--font-sans); font-size: 13px; color: var(--text); padding: 8px 10px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); outline: none;
}
.tk-subtask select:focus, .tk-inline select:focus, .tk-inline input:focus { border-color: var(--neon-cyan); }
.tk-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.tk-inline input { flex: 1 1 200px; }

.tk-feed { display: grid; gap: 9px; }
.tk-note { padding: 11px 14px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--surface-sunken); }
.tk-note.sys { border-color: rgba(226,192,103,.25); background: var(--warning-bg); }
.tk-note-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.tk-note-top strong { font-size: 12.5px; color: var(--text-strong); }
.tk-note-top time { margin-inline-start: auto; color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.tk-note p { margin: 0; color: var(--text-secondary); font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.tk-tag { padding: 2px 7px; border-radius: var(--r-pill); background: rgba(226,192,103,.2); color: var(--warning); font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.tk-rm { border: 0; background: none; padding: 4px 6px; border-radius: 6px; color: var(--text-muted); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.tk-rm:hover { background: var(--danger-bg); color: var(--danger); }

.tk-callout { padding: 11px 14px; border-radius: var(--r-md); font-size: 13px; line-height: 1.6; border: 1px solid var(--hairline); }
.tk-callout strong { display: block; margin-bottom: 2px; }
.tk-callout.ok   { background: var(--success-bg); color: var(--success); border-color: rgba(47,210,122,.3); }
.tk-callout.stop { background: var(--danger-bg);  color: var(--danger);  border-color: rgba(255,77,109,.35); }

.tk-form { display: grid; gap: 14px; }
.tk-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tk-fld { display: flex; flex-direction: column; gap: 5px; }
.tk-fld > span { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-secondary); }
.tk-fld > span i { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--text-muted); font-family: var(--font-sans); margin-inline-start: 6px; }
.tk-fld input, .tk-fld select, .tk-fld textarea {
  font-family: var(--font-sans); font-size: 14px; color: var(--text); padding: 10px 12px; width: 100%;
  background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r-control); outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.tk-fld textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
.tk-fld input:focus, .tk-fld select:focus, .tk-fld textarea:focus { border-color: var(--neon-cyan); box-shadow: 0 0 0 3px rgba(37,214,242,.15); }
.tk-fld select:disabled { opacity: .6; }
[dir="auto"] { unicode-bidi: plaintext; text-align: start; }

/* toast that sits above open dialogs (popover = top layer) */
.tk-toast {
  position: fixed; inset: auto auto 24px 50%; margin: 0; transform: translateX(-50%); border: 1px solid var(--hairline-strong);
  padding: 12px 18px; border-radius: var(--r-md); background: var(--surface-raised); color: var(--text);
  font-size: 13.5px; max-width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow-3);
}
.tk-toast.bad  { background: var(--danger-bg);  color: var(--danger);  border-color: rgba(255,77,109,.4); }
.tk-toast.good { background: var(--success-bg); color: var(--success); border-color: rgba(47,210,122,.35); }
.tk-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 720px) {
  .tk-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .tk-row .tk-chev { display: none; }
  .tk-grid2 { grid-template-columns: 1fr; }
  .tk-board { grid-auto-columns: minmax(min(80vw, 270px), 1fr); scroll-snap-type: x mandatory; }
  .tk-col { scroll-snap-align: start; }
  .tk-dlg-head, .tk-dlg-body, .tk-dlg-foot { padding-inline: 18px; }
  .tk-prose { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { .tk-row, .tk-card, .tk-seg button { transition: none; } }
