/* ============================================================
   TenFour v2 — Portal chrome
   Shell, sidebar brand/footer, theme toggle, hamburger/scrim,
   login page, responsive drawer. Built on tokens.css.
   ============================================================ */

html, body.tf-app { margin: 0; padding: 0; min-height: 100%; }
body.tf-app { background: rgb(var(--color-canvas)); }
.tf-app * { box-sizing: border-box; }

/* Shell + main (tokens.css defines .tf-shell / .tf-sidebar / .tf-main base).
   App-shell scroll model: the shell is pinned to the viewport and ONLY the main
   column scrolls, so the sidebar (and its footer) stay visible on long threads. */
.tf-shell { height: 100vh; overflow: hidden; }
.tf-main  { overflow-y: auto; min-height: 0; }
.tf-sidebar { min-height: 0; }  /* allow the inner .tf-nav to scroll, not the whole rail */
.tf-page  { padding: 18px; }

/* Sidebar structure */
.tf-sidebar { padding: 0; }
.tf-brand { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 16px; }
.tf-brand-mark {
  width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0;
  background: rgb(var(--color-accent)); color: rgb(var(--color-accent-foreground));
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600;
  font-family: 'Epilogue', sans-serif;
}
.tf-brand-name { font-family: 'Epilogue', sans-serif; font-weight: 600; font-size: 15px; color: rgb(var(--color-text)); }

/* Official logo — theme-swapped (teal on light, white on dark) */
.tf-logo { display: block; height: auto; max-width: 100%; }
.tf-logo-on-dark { display: none; }
.tf-app[data-theme="dark"] .tf-logo-on-light { display: none; }
.tf-app[data-theme="dark"] .tf-logo-on-dark { display: block; }
@media (prefers-color-scheme: dark) {
  .tf-app[data-theme="auto"] .tf-logo-on-light { display: none; }
  .tf-app[data-theme="auto"] .tf-logo-on-dark { display: block; }
}

.tf-nav { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.tf-nav .nav-item svg { flex-shrink: 0; }
.tf-nav-section {
  margin: 10px 12px 4px; font-size: 10px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: rgb(var(--color-text-subtle));
}

/* Sidebar footer */
.tf-sidebar-footer { padding: 10px; border-top: 1px solid rgb(var(--color-border-subtle)); display: flex; flex-direction: column; gap: 2px; }
.tf-identity { display: flex; align-items: center; gap: 8px; padding: 4px 6px 8px; }
.tf-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: rgb(var(--color-accent)); color: rgb(var(--color-accent-foreground));
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500;
}
.tf-identity-name { font-size: 13px; font-weight: 500; color: rgb(var(--color-text)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-footer-link {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; background: transparent;
  border-radius: var(--radius-pill); font: inherit; font-size: 12px; font-weight: 500; text-align: left;
  color: rgb(var(--color-text-muted)); text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.tf-footer-link:hover { background: rgb(var(--color-hover)); color: rgb(var(--color-text)); }
/* display:flex above outranks the UA [hidden] rule, so honor hidden explicitly —
   keeps the Install / Enable-notifications buttons out of the DOM flow until JS
   shows them (otherwise they render as dead buttons with no handler attached). */
.tf-footer-link[hidden] { display: none; }
.tf-theme-row { justify-content: space-between; cursor: default; }
.tf-theme-row:hover { background: transparent; color: rgb(var(--color-text-muted)); }
.tf-theme-row > span { display: inline-flex; align-items: center; gap: 8px; }
.tf-notify-toggle .tf-notify-icon { display: inline-flex; }
.tf-notify-toggle.is-on { color: rgb(var(--color-accent-ink)); background: rgb(var(--color-accent-subtle)); }
.tf-notify-toggle.is-on:hover { background: rgb(var(--color-accent-subtle)); color: rgb(var(--color-accent-ink)); }
.tf-notify-toggle:disabled { opacity: .55; cursor: default; }
.tf-notify-toggle:disabled:hover { background: transparent; color: rgb(var(--color-text-muted)); }

/* Apple-style dark-mode toggle (design system §8) */
.theme-toggle { position: relative; width: 32px; height: 18px; background: transparent; border: 0; padding: 0; cursor: pointer; flex-shrink: 0; }
.theme-toggle-track { position: absolute; inset: 0; border-radius: var(--radius-pill); background: rgb(var(--color-surface-sunken)); transition: background-color var(--dur-base) var(--ease-standard); }
.theme-toggle-knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: rgb(var(--color-surface)); box-shadow: var(--shadow-ambient); transition: transform var(--dur-base) var(--ease-standard); }
.theme-toggle.is-on .theme-toggle-track { background: rgb(var(--color-accent)); }
.theme-toggle.is-on .theme-toggle-knob { transform: translateX(14px); }

/* Hamburger + scrim (mobile only) */
.tf-hamburger { display: none; position: absolute; top: 14px; left: 14px; z-index: 40; background: rgb(var(--color-surface)); box-shadow: var(--shadow-ambient); }
.tf-scrim { display: none; }

/* Login cover */
.tf-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgb(var(--color-canvas)); }
.tf-login-card { width: 100%; max-width: 360px; padding: 32px 28px; text-align: center; }
.tf-login-brand { display: flex; justify-content: center; margin-bottom: 22px; }
.tf-login-title { margin: 0 0 6px; font-size: 22px; }
.tf-login-sub { margin: 0 0 24px; font-size: 13px; color: rgb(var(--color-text-muted)); line-height: 1.5; }
.tf-login-button { display: flex; justify-content: center; }
/* The Google Login plugin ships a 40px top margin on its wrapper; the "or"
   divider already provides the spacing here, so collapse the plugin's gap. */
.tf-login-button .wp_google_login { clear: none; margin: 0; }
.tf-login-button .wp_google_login__button-container { margin-top: 0; }
.tf-login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.tf-field-group { display: flex; flex-direction: column; }
.tf-login-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.tf-remember { display: inline-flex; align-items: center; gap: 6px; color: rgb(var(--color-text-muted)); cursor: pointer; }
.tf-remember input { width: 14px; height: 14px; accent-color: rgb(var(--color-accent)); }
.tf-login-link { color: rgb(var(--color-accent-ink)); text-decoration: none; }
.tf-login-link:hover { text-decoration: underline; }
.tf-login-or { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: rgb(var(--color-text-subtle)); font-size: 12px; }
.tf-login-or::before, .tf-login-or::after { content: ""; flex: 1; height: 1px; background: rgb(var(--color-border)); }
.tf-login-notice { font-size: 13px; padding: 9px 12px; border-radius: var(--radius-control); margin-bottom: 16px; background: rgb(var(--color-surface-sunken)); color: rgb(var(--color-text-muted)); text-align: left; }
.tf-login-notice.is-error { background: rgb(var(--color-danger-subtle)); color: rgb(var(--color-danger-ink)); }

/* ---- Projects archive (Phase 1) ------------------------------------- */
.tf-archive { display: flex; flex-direction: column; gap: 14px; }
.tf-archive-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.tf-archive-filter { display: flex; align-items: center; gap: 10px; }
.tf-archive-filter-count { font-size: 12px; color: rgb(var(--color-text-subtle)); }
/* Live search + sort toolbar (mirrors Worksite's All Projects behavior). */
.tf-archive-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tf-archive-search-wrap { position: relative; flex: 1; min-width: 200px; display: flex; align-items: center; }
.tf-archive-search-wrap svg { position: absolute; left: 11px; color: rgb(var(--color-text-subtle)); pointer-events: none; }
.tf-archive-search-wrap .field { width: 100%; padding-left: 34px; }
.tf-archive-sort { display: flex; align-items: center; gap: 8px; }
.tf-archive-sort .field { width: auto; }

.tf-archive-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }

/* .tf-project-card / --unread live in tokens.css; these are the internals. */
.tf-project-card { text-decoration: none; color: inherit; }
.tf-project-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.tf-card-title { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.35; color: rgb(var(--color-text)); font-family: 'Epilogue', sans-serif; overflow-wrap: anywhere; word-break: break-word; }
.tf-card-excerpt { margin: 0; font-size: 12px; color: rgb(var(--color-text-muted)); line-height: 1.5; overflow-wrap: anywhere; word-break: break-word; }
.tf-card-meta { display: flex; align-items: center; gap: 12px; font-size: 11px; color: rgb(var(--color-text-subtle)); }
.tf-card-client { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.tf-client-icon { border-radius: 5px; object-fit: cover; }

/* ---- Single project (Phase 2; redesigned v0.25.0) ------------------- */
/* Layout: conversation card (left) + meta rail (right) on wide screens;
   single column with tabs below 900px. Mobile-first base = single column. */
.tf-project { display: block; }

/* The conversation card. NO overflow:hidden here — it would break the sticky
   head/composer (sticky needs an unclipped path to the .tf-main scroll port). */
.tf-chat { display: flex; flex-direction: column; padding: 0; }
/* The compact title row + thread strip (+ page tabs on mobile) pin together as
   one block on scroll; the description below scrolls away (see .tf-chat-submeta). */
.tf-chat-top { position: sticky; top: 0; z-index: 11; }
.tf-chat-head { background: rgb(var(--color-surface));
                padding: 14px 16px 10px;
                border-radius: var(--radius-card) var(--radius-card) 0 0; }
.tf-chat-submeta { padding: 0 16px; background: rgb(var(--color-surface)); }
.tf-back { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: rgb(var(--color-text-muted)); text-decoration: none; margin-bottom: 8px; }
.tf-back:hover { color: rgb(var(--color-text)); }
.tf-project-titlebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tf-project-desc { margin: 6px 0 0; font-size: 13px; color: rgb(var(--color-text-muted)); max-width: 70ch; }

.tf-tabs { display: flex; gap: 18px; }
/* Page tabs (Discussion / Pinned / …): shown only on mobile, inside the sticky
   .tf-chat-top block. Scrolls sideways instead of clipping when tabs overflow. */
.tf-chat-tabs { display: none; padding: 0 16px; background: rgb(var(--color-surface));
                border-bottom: 1px solid rgb(var(--color-border-subtle));
                overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tf-chat-tabs::-webkit-scrollbar { display: none; }
.tf-chat-tabs .tf-tab { flex: 0 0 auto; white-space: nowrap; }
.tf-tab { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 13px; font-weight: 500; color: rgb(var(--color-text-muted)); padding: 8px 2px; border-bottom: 2px solid transparent; }
.tf-tab:hover { color: rgb(var(--color-text)); }
.tf-tab-active { color: rgb(var(--color-accent-ink)); border-bottom-color: rgb(var(--color-accent)); }

/* Thread tabs — a sub-channel strip across the top of the conversation card. */
.tf-thread-tabs { display: flex; align-items: center; gap: 2px; overflow-x: auto; padding: 4px 10px 6px; background: rgb(var(--color-surface)); border-radius: 0; border-bottom: 1px solid rgb(var(--color-border-subtle)); scrollbar-width: thin; }
.tf-thread-tab { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 13px; font-weight: 500; color: rgb(var(--color-text-muted)); text-decoration: none; padding: 8px 12px; border-radius: var(--radius-control) var(--radius-control) 0 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
/* Inactive tabs hover into the same teal pill as the active thread. */
.tf-thread-tab:hover { color: rgb(var(--color-accent-ink)); background: rgb(var(--color-accent-subtle)); border-radius: var(--radius-pill); }
/* Active conversation reads as a filled teal pill so it's clear which chat you're in. */
.tf-thread-tab.is-active { color: rgb(var(--color-accent-ink)); background: rgb(var(--color-accent-subtle)); border-bottom-color: transparent; border-radius: var(--radius-pill); }
.tf-thread-tab.is-active:hover { background: rgb(var(--color-accent-subtle)); }
.tf-thread-tab.is-closed { color: rgb(var(--color-text-subtle)); }
.tf-thread-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 5px; margin-left: 2px; border-radius: var(--radius-pill); background: rgb(var(--color-accent)); color: rgb(var(--color-accent-foreground)); font-size: 11px; font-weight: 600; line-height: 1; }
.tf-thread-tab[disabled] { opacity: 0.5; cursor: default; }
.tf-thread-add { color: rgb(var(--color-accent-ink)); }
.tf-thread-closed-wrap { position: relative; }
.tf-thread-closed-menu { position: absolute; top: calc(100% + 2px); right: 0; z-index: 20; background: rgb(var(--color-surface)); border: 1px solid rgb(var(--color-border)); border-radius: var(--radius-control); box-shadow: var(--shadow-pop); padding: 5px; display: flex; flex-direction: column; gap: 1px; min-width: 200px; }
.tf-thread-closed-menu a { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: var(--radius-control); font-size: 13px; color: rgb(var(--color-text)); text-decoration: none; }
.tf-thread-closed-menu a:hover { background: rgb(var(--color-surface-sunken)); }
.tf-thread-closed-menu[hidden] { display: none; }
/* The pinned block (.tf-chat-top) now owns the card's rounded top corners
   via .tf-chat-head, which sits at the top of the stack. */
/* Closed-thread banner in place of the composer. */
.tf-thread-closed-note { display: flex; align-items: center; gap: 10px; color: rgb(var(--color-text-muted)); font-size: 13px; }
.tf-thread-closed-text { display: flex; flex-direction: column; gap: 2px; }
.tf-thread-resolution { font-size: 12px; color: rgb(var(--color-text-subtle)); }

/* Context (referenced) messages at the top of a thread. */
.tf-context { display: flex; flex-direction: column; gap: 8px; padding: 12px; margin: 0 0 4px; background: rgb(var(--color-surface-sunken)); border-radius: var(--radius-control); }
.tf-context-head { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: rgb(var(--color-text-subtle)); }
.tf-context-card { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; background: rgb(var(--color-surface)); border: 1px solid rgb(var(--color-border-subtle)); border-radius: var(--radius-control); }
.tf-context-body { flex: 1; min-width: 0; }
.tf-context-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.tf-context-jump { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: rgb(var(--color-accent-ink)); text-decoration: none; }
.tf-context-text { font-size: 13px; color: rgb(var(--color-text-muted)); margin-top: 2px; }
.tf-avatar-sm { width: 24px; height: 24px; font-size: 11px; }

/* Selection mode for adding messages to a thread. */
.tf-comment-check { display: none; align-items: flex-start; padding-top: 4px; }
.tf-project.is-selecting .tf-comment-check { display: flex; }
.tf-project.is-selecting .tf-comment { cursor: default; }
.tf-select-toggle.is-active { color: rgb(var(--color-accent-ink)); }
/* Selection actions sit inline in the thread bar, right beside the Select toggle. */
.tf-select-inline { display: inline-flex; align-items: center; gap: 8px; padding-bottom: 4px; white-space: nowrap; }
.tf-select-inline[hidden] { display: none; }
.tf-select-count { font-size: 13px; font-weight: 500; color: rgb(var(--color-text-muted)); }

/* Generic centered modal (add-to-thread, and reused later). */
.tf-modal-scrim { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgb(0 0 0 / 0.4); }
.tf-modal-scrim[hidden] { display: none; }
.tf-modal { width: 100%; max-width: 400px; padding: 20px; }
.tf-modal .field-label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 4px; color: rgb(var(--color-text-muted)); }
.tf-at-modes label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.tf-at-modes label.is-disabled { opacity: .5; cursor: default; }

/* Add-to-thread: per-message Context (reference) / Chat (move) chooser. */
[data-tf-addthread] .tf-modal { max-width: 480px; }
.tf-at-bulk { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; font-size: 12px; color: rgb(var(--color-text-muted)); }
.tf-at-bulk[hidden] { display: none; }
.tf-at-bulk-label { margin-right: auto; }
.btn-xs { padding: 3px 9px; font-size: 12px; line-height: 1.4; }
.tf-at-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; scrollbar-width: thin; }
.tf-at-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid rgb(var(--color-border-subtle)); border-radius: var(--radius-control); background: rgb(var(--color-surface-sunken)); }
.tf-at-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tf-at-item-msg { font-size: 13px; color: rgb(var(--color-text)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-at-item-author { font-size: 11px; color: rgb(var(--color-text-subtle)); }
.tf-at-seg { display: inline-flex; flex: none; border: 1px solid rgb(var(--color-border)); border-radius: var(--radius-pill); overflow: hidden; background: rgb(var(--color-surface)); }
.tf-at-seg-btn { border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 12px; font-weight: 500; color: rgb(var(--color-text-muted)); padding: 5px 12px; }
.tf-at-seg-btn + .tf-at-seg-btn { border-left: 1px solid rgb(var(--color-border)); }
.tf-at-seg-btn:hover:not(:disabled) { color: rgb(var(--color-text)); }
.tf-at-seg-btn.is-active { background: rgb(var(--color-accent)); color: rgb(var(--color-accent-foreground)); }
.tf-at-seg-btn:disabled { opacity: .4; cursor: default; }

/* Per-thread mute state. */
.tf-thread-mute.is-muted { color: rgb(var(--color-text-muted)); }

.tf-chat-body { display: flex; flex-direction: column; }
.tf-chat-thread { display: flex; flex-direction: column; gap: clamp(16px, 12px + 1.5vw, 32px); padding: 16px; }
.tf-thread-empty { color: rgb(var(--color-text-subtle)); font-size: 13px; padding: 8px 0; }
.tf-comment { display: flex; gap: 11px; }
.tf-avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; color: #fff; }
.tf-comment-main { flex: 1; min-width: 0; }
.tf-comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tf-comment-author { font-size: 13px; font-weight: 500; color: rgb(var(--color-text)); }
.tf-comment-time, .tf-comment-edited { font-size: 11px; color: rgb(var(--color-text-subtle)); }
.tf-pin-chip { padding: 1px 8px; }
.tf-bubble { margin-top: 5px; overflow-wrap: anywhere; }
/* Dark mode: desaturate the "own" bubble fill so light text reads cleanly
   (the default accent-subtle teal is too saturated for comfortable body text). */
.tf-app[data-theme="dark"] .tf-bubble--own { background: rgb(38 56 53); }
@media (prefers-color-scheme: dark) {
  .tf-app[data-theme="auto"] .tf-bubble--own { background: rgb(38 56 53); }
}
/* Paragraph rhythm is stated here, not inherited. The host theme's own `p` rule
   is whatever the theme says it is — several reset it to 0 — so a posted comment
   would lose the spacing the composer showed while typing. The editor gets the
   identical rule so what you type is what gets posted. */
.tf-bubble p, .tf-editor p, .tf-comment-text[contenteditable="true"] p { margin: 0 0 0.75em; }
.tf-bubble p:first-child, .tf-editor p:first-child { margin-top: 0; }
.tf-bubble p:last-child, .tf-editor p:last-child { margin-bottom: 0; }
/* Overflow-safe baseline: a long URL can never push the bubble past its column
   (esp. on phones), even when it isn't unfurled into a link card. */
.tf-bubble a { color: rgb(var(--color-accent-ink)); overflow-wrap: anywhere; word-break: break-word; max-width: 100%; }
/* Rich link preview card (inline, below a lone-URL comment). */
.tf-link-card { display: flex; margin-top: 8px; max-width: 420px; border: 1px solid rgb(var(--color-border)); border-radius: var(--radius-control); overflow: hidden; text-decoration: none; color: inherit; background: rgb(var(--color-surface)); }
.tf-link-card:hover { border-color: rgb(var(--color-border-strong)); }
.tf-link-card-media { flex: 0 0 96px; background: rgb(var(--color-surface-sunken)); }
.tf-link-card-img { width: 96px; height: 100%; min-height: 72px; object-fit: cover; display: block; }
.tf-link-card-body { display: flex; flex-direction: column; gap: 3px; padding: 9px 11px; min-width: 0; }
.tf-link-card-title { font-size: 13px; font-weight: 600; color: rgb(var(--color-text)); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tf-link-card-desc { font-size: 12px; color: rgb(var(--color-text-muted)); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tf-link-card-domain { font-size: 11px; color: rgb(var(--color-text-subtle)); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-link-card--compact { max-width: 340px; }
/* Provider card (Google Docs/Drive, Dropbox, etc.): icon + label + domain. */
.tf-link-card--provider { max-width: 340px; align-items: stretch; }
.tf-link-card-icon { flex: 0 0 44px; display: flex; align-items: center; justify-content: center; background: rgb(var(--color-accent-subtle)); color: rgb(var(--color-accent-ink)); }
.tf-comment-actions { display: flex; align-items: center; gap: 0; margin-top: 6px; margin-left: -6px; }
.tf-act { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 12px; color: rgb(var(--color-text-subtle)); padding: 4px 6px; border-radius: var(--radius-pill); }
/* Unified hover: every comment/thread action lights up with the same teal pill. */
.tf-act:hover { color: rgb(var(--color-accent-ink)); background: rgb(var(--color-accent-subtle)); }
.tf-like-btn.is-liked { color: rgb(var(--color-accent-ink)); }
.tf-like-static { cursor: default; }
.tf-like-count { font-variant-numeric: tabular-nums; }

/* Attachments inside a comment */
.tf-attach-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tf-attach { display: inline-flex; align-items: center; gap: 9px; max-width: 260px; background: rgb(var(--color-surface)); border: 1px solid rgb(var(--color-border)); border-radius: var(--radius-control); padding: 7px 11px; text-decoration: none; color: rgb(var(--color-text)); }
.tf-attach:hover { border-color: rgb(var(--color-border-strong)); }
.tf-attach-icon { color: rgb(var(--color-text-muted)); display: inline-flex; }
.tf-attach-name { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-attach-image img { max-width: 220px; max-height: 220px; border-radius: var(--radius-control); display: block; }

/* Composer — pinned to the bottom of the card; inline (Google-Chat style). */
.tf-chat-composer { position: sticky; bottom: 0; z-index: 8; background: rgb(var(--color-surface));
                    padding: 10px 12px 12px; border-top: 1px solid rgb(var(--color-border-subtle));
                    border-radius: 0 0 var(--radius-card) var(--radius-card); }
.tf-composer-box { border: 1px solid rgb(var(--color-border)); border-radius: var(--radius-control); background: rgb(var(--color-surface)); }
.tf-editor { min-height: 24px; max-height: 200px; overflow-y: auto; padding: 9px 12px; font-size: 1rem; line-height: 1.5; color: rgb(var(--color-text)); outline: none; }
.tf-editor:empty:before { content: attr(data-placeholder); color: rgb(var(--color-text-subtle)); }
.tf-mention-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 8px 6px; }
.tf-mention-btn { border: 0; cursor: pointer; }
.tf-file-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 8px 6px; }
.tf-file-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: rgb(var(--color-surface-sunken)); color: rgb(var(--color-text-muted)); border-radius: var(--radius-pill); padding: 3px 10px; }
.tf-composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 6px 5px; }
.tf-composer-tools { display: flex; align-items: center; gap: 1px; }
/* Cloned composer toolbar shown while editing an existing comment. */
.tf-edit-toolbar { display: flex; align-items: center; gap: 1px; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid rgb(var(--color-border-subtle)); }
.tf-fmt-toggle.is-active { color: rgb(var(--color-accent-ink)); background: rgb(var(--color-accent-subtle)); }
.tf-send-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: none; border: 0; border-radius: 50%; background: rgb(var(--color-accent)); color: rgb(var(--color-accent-foreground)); cursor: pointer; transition: background-color var(--dur-fast); }
.tf-send-btn:hover { background: rgb(var(--color-accent-hover)); }
.tf-send-btn:disabled { opacity: .5; cursor: default; }
.tf-pop-wrap { position: relative; display: inline-flex; }
.tf-mention-pop { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 20; background: rgb(var(--color-surface)); border: 1px solid rgb(var(--color-border)); border-radius: var(--radius-control); box-shadow: var(--shadow-pop); padding: 5px; display: flex; flex-direction: column; gap: 1px; min-width: 180px; max-height: 240px; overflow-y: auto; }
.tf-mention-pop[hidden] { display: none; }
.tf-mention-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 13px; color: rgb(var(--color-text)); padding: 7px 10px; border-radius: 8px; white-space: nowrap; }
.tf-mention-item:hover { background: rgb(var(--color-hover)); }
.tf-mention-item--all { display: flex; flex-direction: column; gap: 1px; }
.tf-mention-item-label { font-weight: 600; color: rgb(var(--color-accent-ink)); }
.tf-mention-item-sub { font-size: 11px; color: rgb(var(--color-text-subtle)); }
.tf-mention-sep { height: 1px; margin: 4px 6px; background: rgb(var(--color-border)); }

/* Inline @ autocomplete dropdown (anchored to the caret; appended to body). */
.tf-mention-ac { position: fixed; z-index: 120; min-width: 180px; max-width: 280px; max-height: 220px; overflow-y: auto; background: rgb(var(--color-surface)); border: 1px solid rgb(var(--color-border)); border-radius: var(--radius-control); box-shadow: var(--shadow-pop); padding: 4px; }
.tf-mention-ac[hidden] { display: none; }
.tf-mention-ac-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 13px; color: rgb(var(--color-text)); padding: 7px 10px; border-radius: 8px; white-space: nowrap; }
.tf-mention-ac-item.is-active, .tf-mention-ac-item:hover { background: rgb(var(--color-hover)); }
.tf-mention-ac-item--all { font-weight: 600; color: rgb(var(--color-accent-ink)); }

/* ---- Mention pill ------------------------------------------------------
   A confirmed mention. Deliberately loud enough that "chip vs. plain text" is
   readable at a glance — that contrast is what tells you whether the person
   will actually be notified. Same chip in the composer and in a posted message,
   so what you typed is what you sent. */
.tf-mention {
	display: inline-block;
	padding: 1px 7px;
	border-radius: var(--radius-pill);
	background: rgb(var(--color-accent-subtle));
	color: rgb(var(--color-accent-ink));
	font-weight: 500;
	/* The chip is one object — a line break must never land inside a name.
	   Atomicity in the editor comes from contenteditable="false", not from
	   user-select, which misbehaves inside contenteditable on Firefox/Safari. */
	white-space: nowrap;
	line-height: 1.35;
}
.tf-mention--all { box-shadow: inset 0 0 0 1px rgb(var(--color-accent) / .35); }

/* In the editor the chip is atomic (contenteditable=false): show a text caret
   rather than the I-beam-inside-a-word affordance it doesn't have. */
.tf-editor .tf-mention,
.tf-comment-text[contenteditable="true"] .tf-mention { cursor: default; }
.tf-composer-msg { font-size: 12px; margin: 8px 2px 0; }
.tf-composer-msg.is-error { color: rgb(var(--color-danger-ink)); }

/* ---- Meta rail: Pinned / Docs / Media (right column on wide screens) -- */
.tf-side { display: flex; flex-direction: column; gap: 12px; }
.tf-side-box { padding: 0; }
.tf-side-head { display: flex; align-items: center; gap: 7px; padding: 11px 14px; font-size: 13px; font-weight: 500; color: rgb(var(--color-text)); border-bottom: 1px solid rgb(var(--color-border-subtle)); }
.tf-side-head svg { color: rgb(var(--color-text-muted)); }
.tf-side-count { margin-left: auto; }
/* One-line description under a rail header, orienting clients to the section. */
.tf-side-sub { margin: 0; padding: 10px 14px 0; font-size: 11px; line-height: 1.45; color: rgb(var(--color-text-subtle)); }
.tf-side-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.tf-side-sub + .tf-side-body { padding-top: 8px; }
.tf-side-empty { font-size: 12px; color: rgb(var(--color-text-subtle)); margin: 0; }
.tf-side-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tf-side-item-name { font-size: 12px; font-weight: 500; color: rgb(var(--color-text)); }
.tf-side-unpin { flex: none; color: rgb(var(--color-accent-ink)); }
.tf-side-item-text { font-size: 12px; color: rgb(var(--color-text-muted)); margin-top: 2px; }
.tf-side-item--jump { cursor: pointer; margin: -4px -8px; padding: 4px 8px; border-radius: var(--radius-control); transition: background-color var(--dur-fast); }
.tf-side-item--jump:hover { background: rgb(var(--color-hover)); }
.tf-side-item--jump:focus-visible { outline: 2px solid rgb(var(--color-accent)); outline-offset: 1px; }

/* Flash a comment when jumped to from the Pinned rail. */
.tf-comment.is-flash .tf-bubble { animation: tf-flash 2.2s var(--ease-standard); }
@keyframes tf-flash {
  0%, 18% { box-shadow: 0 0 0 2px rgb(var(--color-accent)); }
  100% { box-shadow: 0 0 0 0 rgb(var(--color-accent) / 0); }
}
.tf-side-doc { display: flex; align-items: center; gap: 6px; }
/* Name + meta stack, so the row's controls stay centred alongside both lines. */
.tf-side-doc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tf-side-doc-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: rgb(var(--color-accent-ink)); text-decoration: none; }
.tf-side-doc-name:hover .tf-side-doc-label { text-decoration: underline; }
/* The icon must never be squeezed. As a bare flex item it shrinks to a sliver
   (then clips away entirely) the moment a doc name runs long — which is why
   icons appeared only on short names. */
.tf-side-doc-ic { flex: 0 0 auto; display: inline-flex; align-items: center; }
/* Truncation belongs on this span: text-overflow is ignored on a flex
   container, so the ellipsis previously declared on .tf-side-doc-name never
   took effect and long names hard-clipped at the panel edge instead. */
.tf-side-doc-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-side-doc-meta { font-size: 10px; line-height: 1.4; color: rgb(var(--color-text-subtle)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Manager doc controls: drag handle + dragging state. */
.tf-doc-handle { display: inline-flex; align-items: center; color: rgb(var(--color-text-subtle)); cursor: grab; touch-action: none; flex: 0 0 auto; }
.tf-doc-handle:active { cursor: grabbing; }
.tf-side-doc.tf-doc-dragging { opacity: .6; background: rgb(var(--color-hover)); border-radius: var(--radius-control); }
.tf-side-media { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tf-side-media-item { aspect-ratio: 1; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: rgb(var(--color-surface-sunken)); color: rgb(var(--color-text-muted)); }
.tf-side-media-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tf-doc-add { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.tf-doc-add-actions { display: flex; gap: 6px; align-items: center; }
.field-sm { height: 32px; font-size: 12px; padding: 0 10px; }
.icon-btn-sm { width: 26px; height: 26px; }

/* ---- Toasts (transient feedback) ------------------------------------ */
.tf-toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 95; max-width: calc(100vw - 32px); padding: 10px 16px; background: rgb(var(--color-text)); color: rgb(var(--color-canvas)); border-radius: var(--radius-pill); box-shadow: var(--shadow-overlay); font-size: 13px; font-weight: 500; text-align: center; }
.tf-toast.is-error { background: rgb(var(--color-danger)); color: #fff; }

/* ---- App update toast (new version available) ----------------------- */
.tf-update-toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 8px 8px 8px 16px; background: rgb(var(--color-surface)); border: 1px solid rgb(var(--color-border)); border-radius: var(--radius-pill); box-shadow: var(--shadow-overlay); font-size: 13px; color: rgb(var(--color-text)); }
.tf-update-toast .btn-sm { flex: none; }

/* ---- "What's New" walkthrough --------------------------------------- */
.tf-wn-scrim { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--modal-backdrop); }
.tf-wn { position: relative; width: 100%; max-width: 420px; background: rgb(var(--color-surface)); border-radius: var(--radius-panel); box-shadow: var(--shadow-overlay); padding: 28px 26px 20px; }
.tf-wn-close { position: absolute; top: 10px; right: 10px; }
.tf-wn-slide { text-align: center; }
.tf-wn-media { display: flex; justify-content: center; margin: 4px 0 18px; }
.tf-wn-icon { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; background: rgb(var(--color-accent-subtle)); color: rgb(var(--color-accent-ink)); }
.tf-wn-media img { max-width: 100%; border-radius: var(--radius-card); display: block; }
.tf-wn-title { margin: 0 0 8px; font-size: 18px; }
.tf-wn-body { margin: 0; font-size: 14px; line-height: 1.6; color: rgb(var(--color-text-muted)); }
.tf-wn-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.tf-wn-dots { display: flex; gap: 6px; }
.tf-wn-dot { width: 7px; height: 7px; border-radius: 50%; background: rgb(var(--color-border-strong)); cursor: pointer; transition: background-color var(--dur-fast); }
.tf-wn-dot.is-on { background: rgb(var(--color-accent)); }
.tf-wn-nav { display: flex; gap: 8px; }

/* ---- Preview as client ---------------------------------------------- */
.tf-preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 18px 0; padding: 9px 14px; background: rgb(var(--color-notify-subtle)); color: rgb(var(--color-notify-ink)); border: 1px solid rgb(var(--color-notify-ink) / 0.3); border-radius: var(--radius-control); font-size: 13px; font-weight: 500; }
.tf-preview-bar span { display: inline-flex; align-items: center; gap: 8px; }
.tf-preview-exit { border: 0; background: rgb(var(--color-notify-ink)); color: #fff; border-radius: var(--radius-pill); padding: 5px 13px; font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.tf-preview-exit:hover { opacity: .9; }
.tf-preview-toggle.is-on, .tf-preview-toggle.is-on:hover { color: rgb(var(--color-notify-ink)); background: rgb(var(--color-notify-subtle)); }

/* ---- Responsive: two columns ≥900px; tabs below 900px --------------- */
@media (min-width: 900px) {
  .tf-project { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 12px; align-items: start; max-width: 1440px; }
  .tf-side { position: sticky; top: 0; align-self: start; max-height: calc(100vh - 16px); overflow-y: auto; }
}
@media (max-width: 899px) {
  .tf-chat-tabs { display: flex; }
  .tf-project:not([data-tab="discussion"]) .tf-chat-body { display: none; }
  .tf-project[data-tab="discussion"] .tf-side { display: none; }
  .tf-side { margin-top: 12px; }
  .tf-side-box { display: none; }
  .tf-project[data-tab="pinned"] .tf-side-box--pinned,
  .tf-project[data-tab="docs"] .tf-side-box--docs,
  .tf-project[data-tab="media"] .tf-side-box--media,
  .tf-project[data-tab="previews"] .tf-side-box--previews { display: block; }
}

/* ---- HTML previews ------------------------------------------------- */
.tf-preview-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tf-preview-link-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; }
.tf-preview-link-name:hover { color: rgb(var(--color-accent-ink)); }
.tf-preview-draft { flex: none; }
.tf-preview-manage { display: inline-block; margin-top: 6px; }
/* Add button floated to the right edge of the Previews box head (v0.65.0). */
.tf-preview-add { margin-left: auto; }
/* Rename affordance appears on hover of a preview row (still tab-focusable). */
.tf-preview-rename { flex: none; opacity: 0; transition: opacity var(--dur-fast); }
.tf-preview-link:hover .tf-preview-rename,
.tf-preview-rename:focus-visible { opacity: 1; }
/* Quick add/rename result banner. */
.tf-preview-notice { font-size: 12px; margin: 0 0 8px; padding: 7px 10px; border-radius: var(--radius-control); }
.tf-preview-notice.is-ok { background: rgb(var(--color-accent-subtle)); color: rgb(var(--color-accent-ink)); }
.tf-preview-notice.is-err { background: rgb(var(--color-danger-subtle, var(--color-surface-sunken))); color: rgb(var(--color-danger-ink)); }
/* Sandboxed preview viewer — focus mode (v0.64.0).
   body.tf-focus (shell.php) collapses the portal nav to a hamburger drawer;
   the viewer is a viewport-pinned grid: toolbar across the top, the sandboxed
   stage on the left, and the feedback rail (the preview's own project thread,
   standard comment system) on the right. */
body.tf-focus .tf-hamburger { display: none; }  /* the toolbar carries its own menu button */
body.tf-focus .tf-sidebar { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: 250px;
                            transform: translateX(-100%); transition: transform var(--dur-base) var(--ease-standard);
                            border-radius: 0 var(--radius-panel) var(--radius-panel) 0; }
body.tf-focus .tf-sidebar.is-open { transform: translateX(0); }
body.tf-focus .tf-scrim { display: block; position: fixed; inset: 0; z-index: 45; background: var(--modal-backdrop); opacity: 0; pointer-events: none; transition: opacity var(--dur-base); }
body.tf-focus .tf-scrim.is-on { opacity: 1; pointer-events: auto; }
body.tf-focus .tf-main { overflow: hidden; display: flex; flex-direction: column; }  /* flex so the page fills what the preview-as-client banner leaves */
body.tf-focus .tf-page { flex: 1; min-height: 0; height: auto; padding: 12px; }

.tf-project.tf-preview-view { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr);
                              gap: 12px; max-width: none; height: 100%;
                              align-items: stretch; /* the ≥900px .tf-project rule sets align-items:start, which collapses the stage/rail to content height */ }

/* Toolbar */
.tf-preview-toolbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
.tf-preview-toolbar-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; flex-wrap: wrap; }
.tf-preview-toolbar-sep { color: rgb(var(--color-text-subtle)); }
.tf-preview-toolbar-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-preview-toolbar-tools { display: flex; align-items: center; gap: 8px; }
.tf-preview-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.tf-preview-size-group { display: flex; gap: 2px; padding: 2px; background: rgb(var(--color-surface-sunken)); border-radius: var(--radius-pill); }
.tf-preview-size-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 26px; border: 0; background: transparent; color: rgb(var(--color-text-muted)); border-radius: var(--radius-pill); cursor: pointer; }
.tf-preview-size-btn:hover { color: rgb(var(--color-text)); }
.tf-preview-size-btn.is-active { background: rgb(var(--color-surface)); color: rgb(var(--color-accent-ink)); box-shadow: var(--shadow-ambient); }

/* Stage: the iframe well; width narrows for tablet/mobile simulation */
.tf-preview-stage { min-height: 0; display: flex; justify-content: center; }
.tf-preview-frame-wrap { position: relative; width: 100%; height: 100%; min-height: 0; margin: 0 auto; border: 1px solid rgb(var(--color-border-subtle)); border-radius: 12px; overflow: hidden; background: #fff; transition: max-width var(--dur-base) var(--ease-standard); }
.tf-preview-view[data-size="tablet"] .tf-preview-frame-wrap { max-width: 768px; }
.tf-preview-view[data-size="mobile"] .tf-preview-frame-wrap { max-width: 390px; }
.tf-preview-frame { width: 100%; height: 100%; border: 0; display: block; }

/* Feedback rail: scrollable thread + pinned composer */
.tf-preview-rail { display: flex; flex-direction: column; min-height: 0; padding: 0; }
.tf-preview-rail-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-size: 13px; font-weight: 600; border-bottom: 1px solid rgb(var(--color-border-subtle)); }
.tf-preview-rail-thread { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 14px; }
.tf-preview-rail .tf-chat-composer { position: static; border-radius: 0 0 var(--radius-card) var(--radius-card); }

/* Narrow screens: stack (toolbar → stage → rail) and let the page scroll */
@media (max-width: 899px) {
  body.tf-focus .tf-main { overflow-y: auto; display: block; }
  body.tf-focus .tf-page { height: auto; }
  .tf-project.tf-preview-view { display: flex; flex-direction: column; height: auto; }
  .tf-preview-stage { height: 65vh; }
  .tf-preview-rail-thread { max-height: 50vh; }
  .tf-preview-toolbar { flex-wrap: wrap; }
}
.tf-preview-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px; text-align: center; border: 1px dashed rgb(var(--color-border-strong)); border-radius: var(--radius); background: rgb(var(--color-surface-sunken)); cursor: pointer; }
.tf-preview-drop .tf-preview-file-name { font-size: 13px; color: rgb(var(--color-text-muted)); }

/* Docs */
.tf-doc-add-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.tf-docs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.tf-doc-card { display: flex; align-items: center; gap: 12px; padding: 14px; }
.tf-doc-ic { width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0; background: rgb(var(--color-surface-sunken)); color: rgb(var(--color-text-muted)); display: flex; align-items: center; justify-content: center; }
.tf-doc-body { flex: 1; min-width: 0; }
.tf-doc-name { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500; color: rgb(var(--color-text)); text-decoration: none; }
.tf-doc-name:hover { color: rgb(var(--color-accent-ink)); }
.tf-doc-meta { font-size: 11px; color: rgb(var(--color-text-subtle)); margin-top: 2px; }

/* Media */
.tf-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tf-media-item { display: flex; flex-direction: column; padding: 0; overflow: hidden; text-decoration: none; color: inherit; }
.tf-media-thumb { width: 100%; height: 130px; object-fit: cover; display: block; }
.tf-media-file { height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: rgb(var(--color-text-muted)); }
.tf-media-fname { font-size: 11px; padding: 0 8px; text-align: center; }
.tf-media-date { font-size: 11px; color: rgb(var(--color-text-subtle)); padding: 8px 10px; }

/* ---- PM console (Phase 3) ------------------------------------------- */
.tf-admin { display: flex; flex-direction: column; gap: 14px; }
.tf-admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }

/* Row-action buttons (design system §3) */
.btn-row { display: inline-flex; align-items: center; justify-content: center; gap: 4px; background: rgb(var(--color-surface)); color: rgb(var(--color-text)); border: 1px solid rgb(var(--color-border)); border-radius: var(--radius-pill); padding: 0 10px; height: 28px; font-size: 12px; font-weight: 500; cursor: pointer; text-decoration: none; line-height: 1; }
.btn-row:hover { background: rgb(var(--color-hover)); border-color: rgb(var(--color-border-strong)); }
.btn-row--icon { width: 28px; height: 28px; padding: 0; color: rgb(var(--color-text-muted)); }
.btn-row--icon:hover { color: rgb(var(--color-text)); }

/* Simple data table. Each .tf-tr is its own grid, so the action column is a
   FIXED width (not auto) — otherwise per-row content would size that column
   differently and the fr columns wouldn't line up across rows. */
.tf-table { overflow: hidden; padding: 0; }
.tf-tr { display: grid; grid-template-columns: 1.7fr 1fr 0.9fr 110px; align-items: center; gap: 12px; padding: 11px 16px; }
.tf-tr + .tf-tr { border-top: 1px solid rgb(var(--color-border-subtle)); }
.tf-tr:not(.tf-tr-head):hover { background: rgb(var(--color-hover)); }
.tf-tr-head { background: rgb(var(--color-surface-sunken)); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: rgb(var(--color-text-muted)); }
.tf-cell-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tf-cell-title a { font-size: 13px; font-weight: 500; color: rgb(var(--color-text)); text-decoration: none; }
.tf-cell-title a:hover { color: rgb(var(--color-accent-ink)); }
.tf-cell-title small { font-size: 11px; color: rgb(var(--color-text-subtle)); }
.tf-assignees { display: flex; align-items: center; }
.tf-avatar-sm { width: 24px; height: 24px; font-size: 10px; border: 2px solid rgb(var(--color-surface)); margin-right: -7px; }
.tf-assignee-more { font-size: 11px; color: rgb(var(--color-text-subtle)); margin-left: 12px; }
.tf-row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.tf-row-actions form { margin: 0; }
.btn-row--danger { color: rgb(var(--color-danger-ink)); border-color: rgb(var(--color-danger) / .35); }
.btn-row--danger:hover { background: rgb(var(--color-danger-subtle)); border-color: rgb(var(--color-danger)); }

/* Active / Trashed segmented toggle (v0.68.0). */
.tf-seg { display: inline-flex; gap: 2px; padding: 3px; background: rgb(var(--color-surface-sunken)); border-radius: var(--radius-pill); align-self: flex-start; }
.tf-seg-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 500; color: rgb(var(--color-text-muted)); text-decoration: none; }
.tf-seg-btn:hover { color: rgb(var(--color-text)); }
.tf-seg-btn.is-active { background: rgb(var(--color-surface)); color: rgb(var(--color-text)); box-shadow: var(--shadow-ambient); }
.tf-seg-count { font-size: 11px; font-weight: 600; color: rgb(var(--color-text-subtle)); }
/* The trashed list trades the assignee column for who trashed it + when, and
   needs a wider action column (Export · Restore · Delete forever). */
.tf-table-trash .tf-tr { grid-template-columns: 1.5fr 0.9fr 0.8fr 300px; }

/* Trash banner on a trashed project's own page. */
.tf-trash-banner { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 9px 12px; border-radius: var(--radius-control); background: rgb(var(--color-notify-subtle)); color: rgb(var(--color-notify-ink)); font-size: 13px; }
.tf-trash-banner .btn { margin-left: auto; flex: none; }

/* ---- Export dialog (v0.68.0) ---------------------------------------- */
.tf-export-modal { max-width: 480px; }
.tf-export-project { margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.tf-export-pre { margin: 0 0 12px; font-size: 12px; color: rgb(var(--color-text-subtle)); }
.tf-export-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.tf-export-check input { width: 16px; height: 16px; accent-color: rgb(var(--color-accent)); }
.tf-export-hint { margin: 4px 0 0 24px; font-size: 11px; color: rgb(var(--color-text-subtle)); }
.tf-export-result { margin: 14px 0 0; padding: 10px 12px; border-radius: var(--radius-control); font-size: 13px; background: rgb(var(--color-surface-sunken)); }
.tf-export-result p { margin: 0 0 6px; }
.tf-export-result p:last-child { margin-bottom: 0; }
.tf-export-result.is-done { background: rgb(var(--color-accent-subtle)); color: rgb(var(--color-accent-ink)); }
.tf-export-result.is-done a { color: inherit; font-weight: 600; }
.tf-export-missing { color: rgb(var(--color-notify-ink)); }
.tf-export-result.is-done .tf-export-missing { color: rgb(var(--color-notify-ink)); }
.tf-purge-list { margin: 0 0 10px; padding-left: 20px; font-size: 13px; color: rgb(var(--color-text-muted)); }
.tf-purge-list li { padding: 1px 0; }
/* The modal action rows now carry up to four buttons (Cancel · Export ·
   Export to Drive & delete · Delete) — let them wrap instead of overflowing. */
.tf-export-modal .tf-modal-actions,
.tf-drive-modal .tf-modal-actions { flex-wrap: wrap; }
.tf-trash-offer { margin-left: 0; }

/* ---- Drive folder picker + editor field (v0.69.0) -------------------- */
.tf-drive-field { display: flex; flex-direction: column; gap: 8px; }
.tf-drive-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 22px; }
.tf-drive-none { font-size: 13px; color: rgb(var(--color-text-subtle)); }
.tf-drive-pending { font-size: 11px; font-style: italic; color: rgb(var(--color-notify-ink)); }
.tf-drive-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tf-drive-help { font-size: 11px; color: rgb(var(--color-text-subtle)); }

.tf-drive-modal { max-width: 480px; }
.tf-drive-crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 0 0 8px; font-size: 12px; }
.tf-drive-crumb { border: 0; background: none; padding: 2px 4px; border-radius: var(--radius-control); font: inherit; color: rgb(var(--color-text-muted)); cursor: pointer; }
.tf-drive-crumb:hover { background: rgb(var(--color-surface-sunken)); color: rgb(var(--color-text)); }
.tf-drive-crumb.is-current { color: rgb(var(--color-text)); font-weight: 600; }
.tf-drive-crumb-static { cursor: default; }
.tf-drive-crumb-static:hover { background: none; }
.tf-drive-crumb-sep { color: rgb(var(--color-text-subtle)); }

/* v0.71.0 — search folders by name, usable before the listing lands. */
.tf-drive-search { display: flex; gap: 6px; margin: 0 0 10px; }
.tf-drive-search .field { flex: 1; min-width: 0; }
.tf-drive-named { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; overflow: hidden; }
.tf-drive-path { font-size: 11px; color: rgb(var(--color-text-subtle)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-drive-row.is-picked .tf-drive-path { color: rgb(var(--color-text-muted)); font-weight: 400; }

.tf-drive-list { max-height: 260px; overflow-y: auto; border: 1px solid rgb(var(--color-border)); border-radius: var(--radius-control); background: rgb(var(--color-surface-sunken)); }
.tf-drive-empty { margin: 0; padding: 18px 14px; font-size: 12px; color: rgb(var(--color-text-subtle)); text-align: center; }
.tf-drive-row { display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px 2px; border-bottom: 1px solid rgb(var(--color-border)); }
.tf-drive-row:last-child { border-bottom: 0; }
.tf-drive-row.is-picked { background: rgb(var(--color-accent-subtle)); }
.tf-drive-pick { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 8px 10px; border: 0; background: none; font: inherit; font-size: 13px; color: rgb(var(--color-text)); text-align: left; cursor: pointer; border-radius: var(--radius-control); }
.tf-drive-pick:hover { background: rgb(var(--color-surface)); }
.tf-drive-row.is-picked .tf-drive-pick { color: rgb(var(--color-accent-ink)); font-weight: 600; }
.tf-drive-ico { flex: none; color: rgb(var(--color-text-subtle)); font-size: 11px; }
.tf-drive-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-drive-open { flex: none; padding: 4px 9px; border: 1px solid rgb(var(--color-border)); border-radius: var(--radius-control); background: rgb(var(--color-surface)); font: inherit; font-size: 11px; color: rgb(var(--color-text-muted)); cursor: pointer; }
.tf-drive-open:hover { color: rgb(var(--color-text)); border-color: rgb(var(--color-text-subtle)); }

.tf-drive-paste { margin: 12px 0 0; font-size: 12px; }
.tf-drive-paste summary { cursor: pointer; color: rgb(var(--color-text-muted)); }
.tf-drive-paste summary:hover { color: rgb(var(--color-text)); }
.tf-drive-paste-row { display: flex; gap: 6px; margin-top: 6px; }
.tf-drive-paste-row .field { flex: 1; min-width: 0; }

/* Editor */
.tf-editor-page { max-width: 660px; }
.tf-editor-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }

/* Assign-users picker */
.tf-picker-count { position: absolute; right: 4px; top: 9px; font-size: 11px; color: rgb(var(--color-text-subtle)); }
.tf-picker-list { border: 1px solid rgb(var(--color-border-subtle)); border-radius: var(--radius-control); max-height: 260px; overflow-y: auto; }
.tf-picker-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; }
.tf-picker-row:hover { background: rgb(var(--color-hover)); }
.tf-picker-id { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tf-picker-name { font-size: 12px; font-weight: 500; color: rgb(var(--color-text)); }
.tf-picker-email { font-size: 11px; color: rgb(var(--color-text-subtle)); }
.tf-picker-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: rgb(var(--color-accent)); }
.tf-picker-divider { padding: 5px 10px; font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: rgb(var(--color-text-subtle)); background: rgb(var(--color-hover)); border-bottom: 1px solid rgb(var(--color-border-subtle)); }

/* ---- Users (3b) ----------------------------------------------------- */
.tf-invite { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: rgb(var(--color-accent-subtle)); border-radius: var(--radius-card); padding: 13px 15px; }
.tf-invite-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: rgb(var(--color-accent-ink)); }
.tf-invite-hint { flex-basis: 100%; margin: 4px 0 0; font-size: 11px; color: rgb(var(--color-accent-ink)); display: inline-flex; align-items: center; gap: 6px; }
.tf-table-users .tf-tr { grid-template-columns: 1.7fr 0.7fr 0.6fr 270px; }
.tf-role-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.tf-role-select { width: auto; padding: 4px 8px; font-size: 12px; height: 28px; }
.tf-user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tf-row-muted { font-size: 11px; color: rgb(var(--color-text-subtle)); }

/* ---- Clients (3c) --------------------------------------------------- */
.tf-client-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.tf-client-card { padding: 14px; display: flex; flex-direction: column; gap: 11px; position: relative; }
.tf-client-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; opacity: 0; transition: opacity var(--dur-fast); }
.tf-client-card:hover .tf-client-actions { opacity: 1; }
.tf-client-actions form { margin: 0; }
.tf-client-top { display: flex; align-items: center; gap: 11px; }
.tf-client-icon-lg { width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; font-family: 'Epilogue', sans-serif; }
.tf-client-name { font-size: 14px; font-weight: 600; color: rgb(var(--color-text)); text-decoration: none; font-family: 'Epilogue', sans-serif; }
.tf-client-name:hover { color: rgb(var(--color-accent-ink)); }
.tf-client-sub { font-size: 11px; color: rgb(var(--color-text-subtle)); }
.tf-client-defaults { border-top: 1px solid rgb(var(--color-border-subtle)); padding-top: 9px; }
.tf-client-defaults-label { font-size: 11px; color: rgb(var(--color-text-muted)); margin-bottom: 6px; }
.tf-icon-field { display: flex; align-items: center; gap: 14px; }

/* Responsive: collapse sidebar to a drawer below 768px */
@media (max-width: 767px) {
  .tf-page { padding: 14px; padding-top: 60px; }
  .tf-hamburger { display: inline-flex; }
  /* When the project head pins to the viewport top, the floating hamburger
     (32px at 14,14) sits over its top-left corner. Indent the back-link row
     and give it the hamburger's height so nothing renders underneath it. */
  .tf-chat-head .tf-back { margin-left: 26px; min-height: 34px; margin-bottom: 4px; }
  .tf-preview-bar { margin: 56px 14px 0; }
  .tf-preview-bar + .tf-page { padding-top: 14px; }
  .tf-sidebar {
    position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: 250px;
    transform: translateX(-100%); transition: transform var(--dur-base) var(--ease-standard);
    border-radius: 0 var(--radius-panel) var(--radius-panel) 0;
  }
  .tf-sidebar.is-open { transform: translateX(0); }
  .tf-scrim { display: block; position: fixed; inset: 0; z-index: 45; background: var(--modal-backdrop); opacity: 0; pointer-events: none; transition: opacity var(--dur-base); }
  .tf-scrim.is-on { opacity: 1; pointer-events: auto; }
}

/* ===================== Desk (helpdesk) ===================== */
/* Nav unread badge */
.tf-nav-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-pill); background: rgb(var(--color-accent)); color: rgb(var(--color-accent-foreground)); font-size: 11px; font-weight: 600; }

/* --- Queue header + filters --- */
.tf-desk-search { margin-left: auto; }
.tf-desk-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.tf-desk-filter { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-pill); background: rgb(var(--color-surface-sunken)); color: rgb(var(--color-text-muted)); font-size: 13px; font-weight: 500; text-decoration: none; border: 1px solid transparent; }
.tf-desk-filter:hover { border-color: rgb(var(--color-border)); }
.tf-desk-filter.is-active { background: rgb(var(--color-accent-subtle)); color: rgb(var(--color-accent-ink)); }
.tf-desk-filter-count { font-size: 11px; opacity: 0.75; }

/* --- Queue list: clean single rows --- */
.tf-desk-list { padding: 0; overflow: visible; }
.tf-desk-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid rgb(var(--color-border-subtle)); position: relative; }
.tf-desk-row:last-child { border-bottom: 0; }
.tf-desk-row:hover { background: rgb(var(--color-hover)); }
.tf-desk-row.is-pinned { background: rgb(var(--color-accent-subtle) / 0.22); }
.tf-desk-row.is-unread .tf-desk-row-subject { font-weight: 700; }
.tf-desk-row.is-unread .tf-desk-row-num { color: rgb(var(--color-accent)); }

.tf-desk-pinbtn { flex: 0 0 auto; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: rgb(var(--color-text-subtle)); cursor: pointer; border-radius: 7px; opacity: 0.3; transition: opacity var(--dur-base, .15s), color var(--dur-base, .15s); }
.tf-desk-row:hover .tf-desk-pinbtn { opacity: 0.7; }
.tf-desk-pinbtn:hover { opacity: 1; background: rgb(var(--color-hover)); color: rgb(var(--color-text)); }
.tf-desk-pinbtn.is-pinned { opacity: 1; color: rgb(var(--color-accent)); }
.tf-desk-pinbtn.is-pinned svg { fill: currentColor; }

.tf-desk-row-link { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.tf-desk-row-num { flex: 0 0 auto; width: 46px; font-variant-numeric: tabular-nums; color: rgb(var(--color-text-subtle)); font-size: 12px; font-weight: 600; }
.tf-desk-row-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tf-desk-row-subject { font-size: 14px; line-height: 1.3; color: rgb(var(--color-text)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-desk-row-who { font-size: 12px; color: rgb(var(--color-text-muted)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-desk-row-status { flex: 0 0 auto; }
.tf-desk-row-time { flex: 0 0 auto; min-width: 80px; text-align: right; font-size: 12px; color: rgb(var(--color-text-subtle)); white-space: nowrap; }

/* --- Assignee avatar + popover menu --- */
.tf-desk-ava { width: 26px; height: 26px; font-size: 11px; }
.tf-desk-ava-xs { width: 20px; height: 20px; font-size: 10px; }
.tf-avatar-empty { background: transparent !important; color: rgb(var(--color-text-subtle)); border: 1px dashed rgb(var(--color-border-strong)); }
.tf-desk-assignee { position: relative; flex: 0 0 auto; }
.tf-desk-ava-btn { border: 0; background: transparent; padding: 0; cursor: pointer; display: inline-flex; border-radius: 50%; }
.tf-desk-ava-btn:hover .tf-avatar { box-shadow: 0 0 0 2px rgb(var(--color-accent-subtle)); }
.tf-desk-ava-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 210px; max-height: 300px; overflow-y: auto; padding: 6px; background: rgb(var(--color-surface)); border: 1px solid rgb(var(--color-border)); border-radius: var(--radius-control); box-shadow: var(--shadow-overlay); }
.tf-desk-ava-opt { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 8px; border-radius: 8px; font-size: 13px; color: rgb(var(--color-text)); cursor: pointer; }
.tf-desk-ava-opt:hover { background: rgb(var(--color-hover)); }
.tf-desk-ava-opt.is-current { background: rgb(var(--color-accent-subtle)); color: rgb(var(--color-accent-ink)); }

/* --- Ticket page --- */
.tf-desk-ticket-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.tf-desk-ticket-title { flex: 1; min-width: 0; }
.tf-desk-num { color: rgb(var(--color-text-subtle)); }
.tf-desk-ticket-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.tf-desk-pin { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-control); border: 1px solid rgb(var(--color-border)); background: transparent; color: rgb(var(--color-text-subtle)); cursor: pointer; }
.tf-desk-pin:hover { color: rgb(var(--color-text)); border-color: rgb(var(--color-border-strong)); }
.tf-desk-pin.is-pinned { color: rgb(var(--color-accent-ink)); background: rgb(var(--color-accent-subtle)); border-color: transparent; }
.tf-desk-pin.is-pinned svg { fill: currentColor; }

.tf-desk-ticket-body { display: grid; grid-template-columns: 1fr 280px; gap: 18px; align-items: start; }
.tf-desk-convo { padding: 18px; }
.tf-desk-comments { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; max-height: 60vh; overflow-y: auto; }
.tf-desk-comment { display: flex; gap: 10px; }
.tf-desk-comment--internal .tf-bubble { background: rgb(var(--color-warning-subtle)); border: 0; border-left: 3px solid rgb(var(--color-warning)); border-radius: 6px; }
.tf-desk-note-chip { font-size: 11px; }

/* Reply composer + separate internal note */
.tf-desk-composer-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgb(var(--color-text-muted)); margin: 0 0 8px; }
.tf-desk-input, .tf-desk-note-input { width: 100%; resize: vertical; }
.tf-desk-note-box { margin-top: 10px; }
.tf-desk-note-add { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px dashed rgb(var(--color-warning)); background: transparent; color: rgb(var(--color-warning-ink)); border-radius: var(--radius-control); font-size: 13px; cursor: pointer; }
.tf-desk-note-add:hover { background: rgb(var(--color-warning-subtle)); }
.tf-desk-note-field { margin-top: 8px; padding: 12px; border-radius: var(--radius-control); background: rgb(var(--color-warning-subtle)); border-left: 3px solid rgb(var(--color-warning)); }
.tf-desk-note-label { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 0 0 8px; color: rgb(var(--color-warning-ink)); }

/* Sidebar */
.tf-desk-side { display: flex; flex-direction: column; gap: 14px; }
.tf-desk-side .tf-side-box { padding: 16px; }
.tf-side-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: rgb(var(--color-text-subtle)); margin: 0 0 10px; }
.tf-desk-side-note { font-size: 12px; margin: 8px 0 0; color: rgb(var(--color-text-muted)); }
.tf-desk-side-meta { font-size: 13px; margin: 8px 0 0; }

@media (max-width: 860px) {
  .tf-desk-ticket-body { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .tf-desk-row-time { display: none; }
}
/* Encourage assigning: the unassigned (user-plus) avatar lights up on hover */
.tf-desk-ava-btn:hover .tf-avatar-empty { border-color: rgb(var(--color-accent)); color: rgb(var(--color-accent)); }

.tf-notify-bar[hidden] { display: none; }

/* ===================== Projects archive: personal pins ===================== */
.tf-project-card { position: relative; }
.tf-project-card-head { padding-right: 24px; }
.tf-pin-overlay { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; color: rgb(var(--color-text-subtle)); background: transparent; border: 0.5px solid transparent; cursor: pointer; opacity: 0; transition: opacity .15s ease, color .15s ease; z-index: 2; }
.tf-project-card:hover .tf-pin-overlay { opacity: .6; }
.tf-pin-overlay:hover { opacity: 1; color: rgb(var(--color-text)); background: rgb(var(--color-hover)); }
.tf-pin-overlay.is-pinned { opacity: 1; color: rgb(var(--color-accent)); background: rgb(var(--color-accent-subtle)); }
.tf-pin-overlay.is-pinned svg { fill: currentColor; }
.tf-pin-overlay:focus-visible { opacity: 1; outline: 2px solid rgb(var(--color-accent)); outline-offset: 1px; }

/* ===================== Teammate invitations ===================== */
.tf-team-banner { padding: 10px 14px; border-radius: var(--radius-control); font-size: 13px; margin-bottom: 14px; }
.tf-team-card { padding: 16px 18px; margin-bottom: 14px; }
.tf-team-card-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; margin: 0 0 12px; }
.tf-team-row-inputs { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0; }
.tf-team-row-inputs .field { flex: 1; min-width: 160px; }
.tf-team-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgb(var(--color-text-muted)); margin: 10px 0 0; }
.tf-team-list { padding: 0.5rem 1.25rem; }
.tf-team-member { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 0.5px solid rgb(var(--color-border-subtle)); }
.tf-team-member:first-child { border-top: 0; }
.tf-team-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tf-team-name { font-size: 14px; font-weight: 500; }
.tf-team-email { font-size: 12px; color: rgb(var(--color-text-muted)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-team-when { font-size: 12px; color: rgb(var(--color-text-subtle)); white-space: nowrap; margin-right: 6px; }

.tf-approval-queue { padding: 12px 18px 4px; margin-bottom: 14px; }
.tf-approval-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 0.5px solid rgb(var(--color-border-subtle)); flex-wrap: wrap; }
.tf-approval-row:first-of-type { border-top: 0; }
.tf-approval-meta { display: block; font-size: 12px; color: rgb(var(--color-text-subtle)); margin-top: 2px; }
.tf-approval-actions { display: flex; gap: 8px; }

.tf-picker-meta { display: block; font-size: 11px; color: rgb(var(--color-text-subtle)); margin-top: 1px; }


/* ===== Docs: add-document button + modal + inline rename (v0.55.1) ===== */
.tf-doc-add-open { width: 100%; justify-content: center; margin-bottom: 8px; }
.tf-modal-title { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.tf-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.tf-doc-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 16px; border: 1.5px dashed rgb(var(--color-border)); border-radius: var(--radius-control); cursor: pointer; color: rgb(var(--color-text-muted)); font-size: 12px; transition: border-color .15s, background .15s; }
.tf-doc-drop:hover { border-color: rgb(var(--color-accent-ink)); }
.tf-doc-drop.is-dragover { border-color: rgb(var(--color-accent-ink)); background: rgb(var(--color-hover)); }
.tf-doc-drop.is-filled { border-style: solid; border-color: rgb(var(--color-accent-ink)); color: rgb(var(--color-accent-ink)); }
.tf-doc-drop-text { display: inline-flex; align-items: center; gap: 6px; }
.tf-doc-drop-link { color: rgb(var(--color-accent-ink)); text-decoration: underline; }
.tf-doc-file-name { font-weight: 600; color: rgb(var(--color-accent-ink)); word-break: break-all; }
.tf-doc-file-name:empty { display: none; }
.tf-doc-or { display: flex; align-items: center; gap: 8px; margin: 12px 0 8px; color: rgb(var(--color-text-muted)); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.tf-doc-or::before, .tf-doc-or::after { content: ""; flex: 1; height: 1px; background: rgb(var(--color-border)); }
.tf-doc-optional { font-weight: 400; color: rgb(var(--color-text-muted)); }
.tf-doc-add-error { margin: 10px 0 0; color: #dc2626; font-size: 12px; }
.tf-doc-add-error[hidden] { display: none; }
.tf-doc-edit-form { display: none; flex: 1 1 auto; gap: 6px; align-items: center; flex-wrap: wrap; }
.tf-doc-edit-input { flex: 1 1 100px; min-width: 0; }
.tf-side-doc.is-editing .tf-doc-edit-form { display: flex; }
.tf-side-doc.is-editing .tf-side-doc-main,
.tf-side-doc.is-editing .tf-doc-edit,
.tf-side-doc.is-editing .tf-doc-del,
.tf-side-doc.is-editing .tf-doc-handle { display: none; }

/* ===== Desk: ticket-alerts bell (v0.67.0) ===== */
.tf-desk-alerts { white-space: nowrap; }
.tf-desk-alerts .tf-desk-alerts-ic { display: none; }
.tf-desk-alerts .ic-off,
.tf-desk-alerts.is-on .ic-on { display: inline-flex; }
.tf-desk-alerts.is-on .ic-off { display: none; }
.tf-desk-alerts.is-on { color: rgb(var(--color-accent-ink)); background: rgb(var(--color-accent-subtle)); }
.tf-desk-alerts.is-on:hover { color: rgb(var(--color-accent-ink)); background: rgb(var(--color-accent-subtle)); }
.tf-desk-alerts:disabled { opacity: .55; cursor: default; }

/* ===== Desk: spam Crypt + original-email viewer (v0.58.0) ===== */
.tf-desk-crypt-link { white-space: nowrap; }
.tf-desk-spam-btn:hover { color: rgb(var(--color-danger-ink)); border-color: rgb(var(--color-danger-ink)); }
.tf-crypt-row { align-items: center; }
.tf-crypt-icon { display: inline-flex; color: rgb(var(--color-text-subtle)); padding: 0 4px; }
.tf-crypt-row .tf-desk-row-main { flex: 1; min-width: 0; }
.tf-crypt-revive { white-space: nowrap; }
.tf-email-modal { max-width: 760px; display: flex; flex-direction: column; max-height: 85vh; }
.tf-email-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.tf-email-modal-meta { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: rgb(var(--color-text-muted)); border-bottom: 0.5px solid rgb(var(--color-border-subtle)); padding-bottom: 10px; margin-bottom: 10px; }
.tf-email-modal-meta strong { display: inline-block; min-width: 38px; color: rgb(var(--color-text-subtle)); font-weight: 600; }
.tf-email-modal-body { flex: 1; min-height: 0; }
.tf-email-frame { width: 100%; height: 55vh; border: 0.5px solid rgb(var(--color-border-subtle)); border-radius: var(--radius-control); background: #fff; }
.tf-email-plain { max-height: 55vh; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 13px; margin: 0; padding: 12px; border: 0.5px solid rgb(var(--color-border-subtle)); border-radius: var(--radius-control); background: rgb(var(--color-surface-sunken)); }
