/* ============================================================
   TeamFlow — Components (Linear component spec)
   ============================================================ */

/* ---------- Buttons — 8px corners, 8px/14px padding, 14px/500 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px; font-weight: 500; line-height: 1.2;
  padding: 8px 14px; min-height: 32px;
  border-radius: var(--r-md);
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  white-space: nowrap; user-select: none;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-focus); }

.btn-secondary { background: var(--surface-1); color: var(--ink); border: 1px solid var(--hairline); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--hairline-strong); }

.btn-tertiary { background: transparent; color: var(--ink-muted); }
.btn-tertiary:hover { background: var(--surface-1); color: var(--ink); }

.btn-inverse { background: var(--ink); color: var(--canvas); }
.btn-inverse:hover { opacity: 0.9; }

.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--hairline); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); border-color: var(--danger); }

.btn-block { width: 100%; }
.btn-lg { min-height: 40px; padding: 10px 18px; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r-md);
  color: var(--ink-subtle); transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Cards — surface-1, hairline, 12px; edge highlight on top ---------- */
.card {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--s-lg);
  box-shadow: inset 0 1px 0 var(--edge-highlight);
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.card:hover { border-color: var(--hairline-strong); }
.card-lifted { background: var(--surface-2); border-color: var(--hairline-strong); }
.card-panel { border-radius: var(--r-xl); } /* screenshot/major panels: 16px */
.card-flat { box-shadow: none; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--ink-muted); }

.input, .textarea, .select {
  width: 100%;
  background: var(--surface-1);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 8px 12px;
  min-height: 36px;
  font-size: 14px;
  transition: border-color var(--t-fast) var(--ease), outline-color var(--t-fast) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-tertiary); }
.input:focus, .textarea:focus, .select:focus {
  outline: 2px solid rgba(255, 90, 31, 0.5); outline-offset: 0;
  border-color: var(--hairline-strong);
}
.textarea { resize: vertical; min-height: 80px; }

/* Themed file inputs — native "Choose file" button matches btn-secondary */
input[type="file"]::file-selector-button {
  font: inherit; font-size: 13px; font-weight: 500;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 6px 12px;
  margin-right: 10px;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
input[type="file"]::file-selector-button:hover {
  background: var(--surface-3);
  border-color: var(--hairline-strong);
}

.input-icon-wrap { position: relative; }
.input-icon-wrap .input { padding-left: 34px; }
.input-icon-wrap > i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-tertiary); font-size: 13px; pointer-events: none;
}

/* ---------- Badges & pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface-2); color: var(--ink-muted);
  font-size: 12px; line-height: 1.4; font-weight: 500;
  border-radius: var(--r-pill); padding: 2px 8px;
  border: 1px solid var(--hairline);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-tertiary); }
.badge-success { color: var(--success); } .badge-success .dot { background: var(--success); }
.badge-warning { color: var(--warning); } .badge-warning .dot { background: var(--warning); }
.badge-danger  { color: var(--danger); }  .badge-danger .dot  { background: var(--danger); }
.badge-primary { color: var(--primary-hover); } .badge-primary .dot { background: var(--primary); }

.count-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--primary); color: var(--on-primary);
  font-size: 11px; font-weight: 600; border-radius: var(--r-pill);
}

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500;
  border-radius: var(--r-sm); padding: 2px 8px;
  background: var(--surface-2); border: 1px solid var(--hairline); color: var(--ink-muted);
}
.tag .swatch { width: 8px; height: 8px; border-radius: 2px; }

/* ---------- Avatars ---------- */
.avatar {
  position: relative; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3);
  color: var(--ink); font-size: 12px; font-weight: 600; letter-spacing: 0;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; }
.avatar .presence {
  position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--canvas); background: var(--ink-tertiary);
}
.avatar .presence.online { background: var(--success); }
.avatar .presence.away { background: var(--warning); }
.avatar .presence.dnd { background: var(--danger); }

.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--surface-1); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- Tabs (pill-toggle, Linear pricing-tab spec) ---------- */
.tabs {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-pill);
}
.tab {
  font-size: 14px; font-weight: 500; color: var(--ink-subtle);
  padding: 6px 14px; border-radius: var(--r-pill); min-height: 32px;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.tab:hover { color: var(--ink-muted); }
.tab.active { background: var(--surface-3); color: var(--ink); }

/* ---------- Dropdown menu — surface-3 lift ---------- */
.dropdown { position: relative; }
.menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  min-width: 200px;
  background: var(--surface-3);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 var(--edge-highlight);
  animation: scale-in var(--t-fast) var(--ease) both;
  transform-origin: top right;
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  font-size: 14px; color: var(--ink-muted); text-align: left;
  padding: 7px 10px; border-radius: var(--r-sm);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.menu-item:hover { background: var(--surface-4); color: var(--ink); }
.menu-item i { width: 16px; text-align: center; font-size: 13px; color: var(--ink-subtle); }
.menu-item.active i { color: var(--primary-hover); }
.menu-divider { height: 1px; margin: 4px 6px; background: var(--hairline); }
.menu-label { font-size: 11px; font-weight: 500; letter-spacing: 0.4px; text-transform: uppercase; color: var(--ink-tertiary); padding: 6px 10px 2px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: var(--scrim);
  display: flex; align-items: center; justify-content: center;
  animation: fade-in var(--t-fast) var(--ease) both;
  padding: var(--s-lg);
}
.modal {
  width: 100%; max-width: 440px;
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), inset 0 1px 0 var(--edge-highlight);
  animation: scale-in var(--t-med) var(--ease) both;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: var(--s-md) var(--s-lg); border-bottom: 1px solid var(--hairline); }
.modal-body { padding: var(--s-lg); }
.modal-footer { display: flex; justify-content: flex-end; gap: var(--s-xs); padding: var(--s-md) var(--s-lg); border-top: 1px solid var(--hairline); }

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed; bottom: var(--s-lg); right: var(--s-lg); z-index: 120;
  display: flex; flex-direction: column; gap: var(--s-xs);
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 360px;
  background: var(--surface-3);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 14px; color: var(--ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 var(--edge-highlight);
  animation: rise-in var(--t-med) var(--ease) both;
}
.toast i { font-size: 14px; }
.toast.success i { color: var(--success); }
.toast.danger i { color: var(--danger); }
.toast.info i { color: var(--primary-hover); }

/* Upload progress toast */
.toast-upload { align-items: flex-start; }
.toast-upload i { margin-top: 2px; }
.toast .toast-col { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0; }
.toast .toast-label {
  font-size: 13px; color: var(--ink-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.toast .toast-progress {
  position: relative; height: 5px; border-radius: var(--r-pill);
  background: var(--surface-1); overflow: hidden;
}
.toast .toast-progress-bar {
  height: 100%; width: 0; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
  transition: width 150ms var(--ease);
}
.toast .toast-progress.indeterminate .toast-progress-bar {
  width: 40%; transition: none;
  animation: toast-indet 1s var(--ease) infinite;
}
@keyframes toast-indet {
  0%   { transform: translateX(-130%); }
  100% { transform: translateX(320%); }
}

/* ---------- Tooltip ---------- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%) translateY(2px);
  background: var(--surface-4); color: var(--ink); font-size: 12px; font-weight: 500;
  border: 1px solid var(--hairline-strong); border-radius: var(--r-sm);
  padding: 4px 8px; white-space: nowrap;
  opacity: 0; pointer-events: none; z-index: 80;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Position variants — use where the default (above) tooltip would be clipped
   (e.g. header bar buttons, or buttons near a scroll/overflow edge). */
[data-tooltip][data-tip="bottom"]::after {
  bottom: auto; top: calc(100% + 6px);
  transform: translateX(-50%) translateY(-2px);
}
[data-tooltip][data-tip="bottom"]:hover::after { transform: translateX(-50%) translateY(0); }

/* Below the button, right-aligned — opens leftward so it stays inside a
   right-hand overflow edge (e.g. the sidebar channels header). */
[data-tooltip][data-tip="bottom-end"]::after {
  bottom: auto; top: calc(100% + 6px);
  left: auto; right: 0;
  transform: translateX(0) translateY(-2px);
}
[data-tooltip][data-tip="bottom-end"]:hover::after { transform: translateX(0) translateY(0); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 500; letter-spacing: 0.4px;
  text-transform: uppercase; color: var(--ink-tertiary);
  padding: 10px 12px; border-bottom: 1px solid var(--hairline);
}
.table td { padding: 12px; border-bottom: 1px solid var(--hairline); color: var(--ink-muted); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background-color var(--t-fast) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }

/* ---------- Progress ---------- */
.progress { height: 4px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: var(--r-pill); transition: width var(--t-slow) var(--ease); }

/* ---------- Divider ---------- */
.divider { height: 1px; background: var(--hairline); border: none; }

/* ---------- Empty state ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-sm);
  padding: var(--s-xxl); color: var(--ink-subtle); text-align: center;
}
.empty-state i { font-size: 28px; color: var(--ink-tertiary); }

/* ---------- Kbd ---------- */
.kbd {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-subtle);
  background: var(--surface-3); border: 1px solid var(--hairline-strong);
  border-bottom-width: 2px; border-radius: var(--r-xs); padding: 1px 5px;
}

/* ---------- Message attachments (Stage 5: files) ---------- */
.attachments {
  display: flex; flex-wrap: wrap; gap: var(--s-xs); margin-top: 6px;
}
.attach-img {
  display: block; max-width: 320px; max-height: 240px; overflow: hidden;
  border: 1px solid var(--hairline); border-radius: var(--r-md); line-height: 0;
  background: var(--surface-2); transition: border-color var(--t-fast) var(--ease);
}
.attach-img:hover { border-color: var(--hairline-strong); }
.attach-img img { max-width: 320px; max-height: 240px; object-fit: cover; display: block; }
.attach-file {
  display: flex; align-items: center; gap: var(--s-xs); min-width: 220px; max-width: 340px;
  padding: 8px 10px; border: 1px solid var(--hairline); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--ink); text-decoration: none;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.attach-file:hover { border-color: var(--hairline-strong); background: var(--surface-3); }
.attach-file .attach-icon {
  display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  flex: none; border-radius: var(--r-sm); background: var(--surface-4); color: var(--primary); font-size: 16px;
}
.attach-file .attach-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.attach-file .attach-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-file .attach-size { font-size: 11px; }
.attach-file .attach-dl { color: var(--ink-tertiary); flex: none; }
.attach-file:hover .attach-dl { color: var(--primary); }

/* ---------- Files page ---------- */
.view-toggle { display: inline-flex; gap: 2px; padding: 2px; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-md); }
.view-toggle .btn-icon.active { background: var(--surface-4); color: var(--primary); }

/* list view */
.files-list { display: flex; flex-direction: column; gap: 2px; }
.file-row {
  display: flex; align-items: center; gap: var(--s-xs); padding: 6px 8px;
  border-radius: var(--r-md); border: 1px solid transparent;
  transition: background var(--t-fast) var(--ease);
}
.file-row:hover { background: var(--surface-2); border-color: var(--hairline); }
.file-open { display: flex; align-items: center; gap: var(--s-sm); flex: 1; min-width: 0; padding: 4px; text-decoration: none; color: var(--ink); }
.file-thumb {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none;
  border-radius: var(--r-sm); background: var(--surface-3); color: var(--primary); font-size: 18px; overflow: hidden;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-sub { font-size: 12px; color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; }
.file-actions { flex: none; display: flex; gap: 4px; opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.file-row:hover .file-actions, .file-card:hover .file-actions { opacity: 1; }
.file-actions [data-del]:hover { color: var(--danger); }

/* grid view */
.files-grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--s-sm); }
.file-card {
  position: relative; display: flex; flex-direction: column;
  border: 1px solid var(--hairline); border-radius: var(--r-lg); background: var(--surface-1);
  overflow: hidden; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.file-card:hover { border-color: var(--hairline-strong); background: var(--surface-2); }
.file-card-preview {
  display: flex; align-items: center; justify-content: center; height: 120px;
  background: var(--surface-3); color: var(--primary); font-size: 40px; text-decoration: none; overflow: hidden;
}
.file-card-preview.has-img { background: var(--surface-4); }
.file-card-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-card-body { display: flex; flex-direction: column; gap: 2px; padding: 10px; min-width: 0; }
.file-card-body .file-name { font-size: 13px; }
.file-card-body .file-sub { font-size: 11px; line-height: 1.4; white-space: normal; }
.file-card .file-actions {
  position: absolute; top: 6px; right: 6px; gap: 2px; padding: 2px;
  background: var(--scrim); border-radius: var(--r-md); backdrop-filter: blur(2px);
}
.file-card .file-actions .btn-icon { color: #fff; }

/* ---------- Tasks page (Stage 6) ---------- */
.task-filter { max-width: 160px; flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-md); }

/* list view */
.tk-list { display: flex; flex-direction: column; gap: 2px; }
.tk-row {
  display: flex; align-items: center; gap: var(--s-sm); padding: 8px 10px;
  border-radius: var(--r-md); border: 1px solid transparent; transition: background var(--t-fast) var(--ease);
}
.tk-row:hover { background: var(--surface-2); border-color: var(--hairline); }
.tk-check {
  width: 20px; height: 20px; flex: none; border-radius: var(--r-pill);
  border: 1.5px solid var(--hairline-tertiary); background: transparent; color: transparent;
  display: flex; align-items: center; justify-content: center; font-size: 10px; cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.tk-check:hover { border-color: var(--primary); color: var(--ink-tertiary); }
.tk-row.is-done .tk-check { background: var(--success); border-color: var(--success); color: #fff; }
.tk-row.is-done .tk-title { text-decoration: line-through; color: var(--ink-tertiary); }
.tk-key { font-family: var(--font-mono); font-size: 11px; color: var(--ink-tertiary); flex: none; min-width: 46px; }
.tk-title { font-size: 14px; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.tk-badges { display: flex; align-items: center; gap: var(--s-xs); flex: none; }
.tk-status { font-size: 11px; padding: 1px 8px; border-radius: var(--r-pill); border: 1px solid var(--hairline-strong); color: var(--ink-subtle); }
.tk-status.s-todo { color: var(--ink-subtle); }
.tk-status.s-in_progress { color: var(--tag-blue); border-color: color-mix(in srgb, var(--tag-blue) 40%, transparent); }
.tk-status.s-done { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.tk-status.s-cancelled { color: var(--ink-tertiary); text-decoration: line-through; }
.tk-due { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-subtle); }
.tk-due i { font-size: 10px; }
.tk-due.due-soon { color: var(--warning); }
.tk-due.due-over { color: var(--danger); }
.tk-unassigned { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--ink-tertiary); }
.tk-del { opacity: 0; }
.tk-row:hover .tk-del { opacity: 1; }
.tk-del:hover { color: var(--danger); }

/* board view */
.tk-board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: var(--s-sm); align-items: start; }
.tk-col { background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); display: flex; flex-direction: column; min-height: 120px; }
.tk-col-head { display: flex; align-items: center; gap: var(--s-xs); padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--ink-muted); border-bottom: 1px solid var(--hairline); }
.tk-col-head i { color: var(--ink-tertiary); font-size: 12px; }
.tk-col-count { margin-left: auto; font-size: 11px; color: var(--ink-tertiary); background: var(--surface-3); border-radius: var(--r-pill); padding: 0 7px; }
.tk-col-body { display: flex; flex-direction: column; gap: var(--s-xs); padding: var(--s-xs); min-height: 60px; transition: background var(--t-fast) var(--ease); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.tk-col-body.drop-hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.tk-card {
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: 10px; cursor: grab; transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.tk-card:hover { border-color: var(--hairline-strong); }
.tk-card.dragging { opacity: 0.5; cursor: grabbing; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.tk-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.tk-card-title { font-size: 13px; color: var(--ink); line-height: 1.35; cursor: pointer; margin-bottom: 8px; }
.tk-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-xs); }
.tk-card-foot:empty { display: none; }

/* ---------- Tasks: channel tag, filter chip, due tweak (Stage 6.1) ---------- */
.tk-due i { opacity: .75; }
.tk-chan {
  display: inline-flex; align-items: center; font-size: 11px; font-family: var(--font-mono);
  color: var(--tag-blue); background: color-mix(in srgb, var(--tag-blue) 14%, transparent);
  border-radius: var(--r-sm); padding: 1px 6px; text-decoration: none;
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tk-chan:hover { text-decoration: underline; }
.tk-card-chan { margin-bottom: 8px; }
.tk-chip-bar { margin-top: var(--s-sm); }
.tk-filter-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-muted);
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-pill);
  padding: 4px 6px 4px 10px;
}
.tk-filter-chip > i { color: var(--ink-tertiary); font-size: 11px; }
.tk-filter-chip button {
  border: none; background: var(--surface-4); color: var(--ink-subtle);
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 10px;
}
.tk-filter-chip button:hover { color: var(--danger); background: var(--surface-3); }

/* ---------- Tasks: Gantt / timeline ---------- */
.tk-g-scrollwrap { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--r-lg); background: var(--surface-1); }
.tk-g-inner { position: relative; }
.tk-g-head { display: flex; position: sticky; top: 0; z-index: 3; background: var(--surface-2); border-bottom: 1px solid var(--hairline); }
.tk-g-corner {
  width: 220px; flex: none; position: sticky; left: 0; z-index: 4; background: var(--surface-2);
  border-right: 1px solid var(--hairline); display: flex; align-items: flex-end; padding: 6px 12px;
  font-size: 12px; font-weight: 600; color: var(--ink-muted);
}
.tk-g-scale { flex: none; }
.tk-g-months { display: flex; height: 22px; }
.tk-g-month { flex: none; box-sizing: border-box; border-right: 1px solid var(--hairline); font-size: 11px; font-weight: 600; color: var(--ink-muted); padding: 3px 6px; white-space: nowrap; overflow: hidden; }
.tk-g-days { display: flex; }
.tk-g-day { width: 34px; flex: none; box-sizing: border-box; text-align: center; font-size: 10px; color: var(--ink-tertiary); padding: 3px 0; border-right: 1px solid var(--hairline); }
.tk-g-day.wknd { background: var(--surface-1); }
.tk-g-day.today { color: var(--primary); font-weight: 700; }
.tk-g-row { display: flex; align-items: center; height: 38px; border-bottom: 1px solid var(--hairline); }
.tk-g-row:last-child { border-bottom: none; }
.tk-g-label {
  width: 220px; flex: none; position: sticky; left: 0; z-index: 2; background: var(--surface-1);
  border-right: 1px solid var(--hairline); height: 100%; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; cursor: pointer; overflow: hidden;
}
.tk-g-row:hover .tk-g-label { background: var(--surface-2); }
.tk-g-name { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-g-track { position: relative; height: 100%; flex: none; background-image: repeating-linear-gradient(90deg, transparent 0, transparent 33px, var(--hairline) 33px, var(--hairline) 34px); }
.tk-g-gridline { position: absolute; top: 0; bottom: 0; width: 2px; background: color-mix(in srgb, var(--primary) 55%, transparent); z-index: 1; }
.tk-bar {
  position: absolute; top: 8px; height: 22px; border-radius: var(--r-sm); display: flex; align-items: center;
  padding: 0 8px; cursor: pointer; z-index: 2; box-shadow: inset 0 1px 0 var(--edge-highlight);
  overflow: hidden; transition: filter var(--t-fast) var(--ease);
}
.tk-bar:hover { filter: brightness(1.1); }
.tk-bar-label { font-size: 11px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-bar.is-done { opacity: 0.5; }
.prio-bar-urgent { background: var(--tag-red); }
.prio-bar-high { background: var(--tag-orange); }
.prio-bar-medium { background: var(--primary); }
.prio-bar-low { background: var(--ink-subtle); }

/* ---------------- Realtime: presence dots + typing indicator ---------------- */
.avatar-wrap { position: relative; display: inline-flex; vertical-align: middle; }
.presence-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink-tertiary);
  box-shadow: 0 0 0 2px var(--canvas);
  transition: background .2s ease;
}
.presence-dot.online  { background: var(--success); }
.presence-dot.away    { background: var(--warning); }
.presence-dot.dnd     { background: var(--danger); }
.presence-dot.offline { background: var(--ink-tertiary); }

.typing-indicator {
  min-height: 0; height: 0; overflow: hidden;
  display: flex; align-items: center; gap: 8px;
  padding: 0 20px; font-size: 12px; color: var(--ink-subtle);
  opacity: 0; transition: opacity .15s ease, height .15s ease, min-height .15s ease;
}
.typing-indicator.show { height: auto; min-height: 20px; opacity: 1; padding-bottom: 4px; }
.typing-dots { display: inline-flex; gap: 3px; align-items: center; }
.typing-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--ink-subtle); display: inline-block;
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
