/* (TDRIVE) Team Drive collaboration UI - Share, Comments, Activity, Notifications, Agents, Teams.
 * Mounted inside .cos-root, so every colour is a shell token and every theme applies as-is. No
 * literal light fill anywhere: the one literal is #fff for text ON the accent, which reads on the
 * accent in every theme. */

.tm-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- modal ---------- */
.tm-ov { position: fixed; inset: 0; z-index: 320; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px; background: rgba(8, 11, 16, .42); }
.tm-dlg { width: 560px; max-width: 100%; min-width: 0; max-height: min(86dvh, 820px); display: flex; flex-direction: column; background: var(--cos-surface); color: var(--cos-text); border: 1px solid var(--cos-line-1); border-radius: var(--cos-radius-card); box-shadow: var(--cos-shadow-pop); font-size: 14px; line-height: 1.45; }
.tm-dlg.tm-activity, .tm-dlg.tm-agents, .tm-dlg.tm-teams { width: 600px; }
.tm-dlg.tm-linkview { width: 720px; }
.tm-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--cos-line-2); }
.tm-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 17px; font-weight: 650; color: var(--cos-ink-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-body { padding: 16px 20px 18px; overflow-y: auto; overscroll-behavior: contain; }
.tm-x { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border: 0; background: transparent; color: var(--cos-ink-2); border-radius: var(--cos-radius-ctl); cursor: pointer; }
.tm-x:hover { background: var(--cos-wash); color: var(--cos-text); }

/* ---------- controls ---------- */
.tm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1px solid var(--cos-line-ctl); border-radius: var(--cos-radius-ctl); background: var(--cos-surface); color: var(--cos-text); font: inherit; font-size: 13.5px; font-weight: 550; cursor: pointer; white-space: nowrap; transition: background-color .12s ease-out, border-color .12s ease-out; }
.tm-btn:hover { background: var(--cos-wash); }
.tm-btn:active { background: var(--cos-wash-strong); }
.tm-btn:disabled { opacity: .55; cursor: default; }
.tm-btn.tm-primary { background: var(--cos-accent); border-color: transparent; color: #fff; }
.tm-btn.tm-primary:hover { background: var(--cos-accent-hover); }
.tm-btn.tm-btn-quiet { border-color: transparent; background: transparent; color: var(--cos-ink-2); padding: 0 10px; }
.tm-btn.tm-btn-quiet:hover { background: var(--cos-wash); color: var(--cos-text); }
.tm-btn.tm-danger { border-color: transparent; background: color-mix(in srgb, var(--cos-red) 14%, transparent); color: var(--cos-red); }
.tm-btn svg { flex: 0 0 auto; }
.tm-ibtn { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--cos-ink-3); border-radius: var(--cos-radius-ctl); cursor: pointer; }
.tm-ibtn:hover { background: var(--cos-wash); color: var(--cos-text); }
.tm-in { width: 100%; min-width: 0; font: inherit; font-size: 15px; line-height: 1.45; padding: 8px 11px; border: 1px solid var(--cos-line-ctl); border-radius: var(--cos-radius-ctl); background: var(--cos-surface); color: var(--cos-text); resize: vertical; }
.tm-in::placeholder { color: var(--cos-ink-4); }
.tm-sel { font: inherit; font-size: 13.5px; min-height: 36px; padding: 0 8px; border: 1px solid var(--cos-line-ctl); border-radius: var(--cos-radius-ctl); background: var(--cos-surface); color: var(--cos-text); max-width: 100%; cursor: pointer; }
.tm-dlg :focus-visible, .tm-side :focus-visible, .tm-pop :focus-visible { outline: 2px solid var(--cos-accent); outline-offset: 2px; }
.tm-in:focus-visible, .tm-sel:focus-visible { outline-offset: 0; }
.tm-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--cos-ink-2); cursor: pointer; min-height: 32px; }
.tm-check input { width: 16px; height: 16px; accent-color: var(--cos-accent); }

.tm-err { margin: 8px 0 0; padding: 8px 12px; border-inline-start: 3px solid var(--cos-red); background: color-mix(in srgb, var(--cos-red) 8%, transparent); color: var(--cos-text); font-size: 13px; border-radius: 0 var(--cos-radius-ctl) var(--cos-radius-ctl) 0; }
.tm-err[hidden] { display: none; }
.tm-note { margin: 0 0 12px; color: var(--cos-ink-2); font-size: 13.5px; }
.tm-loading { display: flex; align-items: center; gap: 10px; padding: 20px 4px; color: var(--cos-ink-3); font-size: 13.5px; }
.tm-spin { width: 14px; height: 14px; flex: 0 0 auto; border: 2px solid color-mix(in srgb, var(--cos-accent) 25%, transparent); border-top-color: var(--cos-accent); border-radius: 50%; animation: tm-rot .8s linear infinite; }
@keyframes tm-rot { to { transform: rotate(360deg); } }
.tm-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 16px; text-align: center; color: var(--cos-ink-3); font-size: 13.5px; }
.tm-empty p { margin: 0; max-width: 42ch; }
.tm-empty svg { color: var(--cos-ink-4); }
.tm-h3 { margin: 18px 0 8px; font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--cos-ink-3); }
.tm-badge { display: inline-block; padding: 0 6px; border-radius: 999px; font-size: 10.5px; font-weight: 650; line-height: 17px; color: var(--cos-indigo); background: color-mix(in srgb, var(--cos-indigo) 14%, transparent); vertical-align: 1px; }
.tm-rolelbl { font-size: 13px; color: var(--cos-ink-3); white-space: nowrap; }

/* ---------- avatars ---------- */
.tm-av { --tm-hue: var(--cos-accent); width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 650; color: var(--tm-hue); background: color-mix(in srgb, var(--tm-hue) 16%, var(--cos-surface)); }
.tm-av.sm { width: 26px; height: 26px; font-size: 11px; }
.tm-av svg { width: 15px; height: 15px; }
.tm-av-green { --tm-hue: var(--cos-green); } .tm-av-orange { --tm-hue: var(--cos-orange); } .tm-av-indigo { --tm-hue: var(--cos-indigo); }
.tm-av-red { --tm-hue: var(--cos-red); } .tm-av-online { --tm-hue: var(--cos-online); } .tm-av-accent { --tm-hue: var(--cos-accent); }
.tm-av-agent { --tm-hue: var(--cos-indigo); border-radius: 9px; }
.tm-av-team { --tm-hue: var(--cos-green); border-radius: 9px; }

/* ---------- people lists (share, teams, agents) ---------- */
.tm-plist, .tm-alist, .tm-notes, .tm-feed { list-style: none; margin: 0; padding: 0; }
.tm-prow, .tm-arow { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.tm-pmain { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.tm-pmain b { font-weight: 600; color: var(--cos-ink-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-pmain b i { font-style: normal; font-weight: 400; color: var(--cos-ink-3); }
.tm-pmain small { font-size: 12.5px; color: var(--cos-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-pright { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }

/* ---------- share ---------- */
.tm-addrow { display: flex; gap: 8px; align-items: stretch; }
.tm-addrow .tm-suggestwrap, .tm-addrow > .tm-in { flex: 1 1 auto; }
.tm-suggestwrap { position: relative; min-width: 0; }
.tm-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; margin: 0; padding: 4px; list-style: none; max-height: 280px; overflow-y: auto; background: var(--cos-surface); border: 1px solid var(--cos-line-1); border-radius: var(--cos-radius-ctl); box-shadow: var(--cos-shadow-pop); }
.tm-suggest[hidden] { display: none; }
.tm-sg { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: var(--cos-radius-ctl); cursor: pointer; }
.tm-sg span { display: flex; flex-direction: column; min-width: 0; }
.tm-sg b { font-weight: 600; font-size: 13.5px; color: var(--cos-ink-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-sg small { font-size: 12px; color: var(--cos-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-sg:hover, .tm-sg.on { background: var(--cos-accent-soft); }
.tm-notify { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tm-msg { font-size: 14px; }
.tm-general { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--cos-line-2); border-radius: var(--cos-radius-card); background: var(--cos-surface-2); }
.tm-genico { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--cos-surface); color: var(--cos-ink-2); }
.tm-genmain { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; flex: 1; }
.tm-genmain small { flex-basis: 100%; font-size: 12.5px; color: var(--cos-ink-3); }
.tm-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--cos-line-2); }
.tm-footl { display: flex; flex-wrap: wrap; gap: 2px; min-width: 0; }

/* ---------- forms (agents, spaces) ---------- */
.tm-form { display: flex; flex-direction: column; gap: 12px; }
.tm-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 550; color: var(--cos-ink-2); }
.tm-formrow { display: flex; gap: 12px; flex-wrap: wrap; }
.tm-formrow label { flex: 1 1 200px; }

/* ---------- teams ---------- */
.tm-team { border: 1px solid var(--cos-line-2); border-radius: var(--cos-radius-card); margin-bottom: 8px; background: var(--cos-surface); }
.tm-team.open { background: var(--cos-surface-2); }
.tm-teamhead { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: var(--cos-radius-card); min-height: 52px; }
.tm-teamhead:hover { background: var(--cos-wash); }
.tm-teamhead svg:last-child { color: var(--cos-ink-3); }
.tm-team .tm-plist, .tm-team .tm-addrow, .tm-teamacts { padding: 0 12px; }
.tm-teamacts { display: flex; justify-content: flex-end; padding-top: 8px; padding-bottom: 10px; }
.tm-team .tm-addrow { padding-top: 6px; }
.tm-newteam { margin-top: 14px; }

/* ---------- comments panel ---------- */
/* z-index 130: a side panel, not a modal - it stays under the setup wizard (140) and every prompt (300) */
.tm-side { position: fixed; top: 0; right: 0; bottom: 0; z-index: 130; width: 384px; max-width: 100vw; display: flex; flex-direction: column; background: var(--cos-surface); color: var(--cos-text); border-left: 1px solid var(--cos-line-1); box-shadow: var(--cos-shadow-pop); font-size: 14px; line-height: 1.45; animation: tm-slide .22s ease-out; }
@keyframes tm-slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 1100px) { html.tm-side-open .cos-tilearea { margin-right: 384px; } }
.tm-sidehead { display: flex; align-items: center; gap: 8px; padding: 12px 10px 12px 16px; border-bottom: 1px solid var(--cos-line-2); }
.tm-sidetitle { flex: 1; min-width: 0; }
.tm-sidetitle h2 { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 15.5px; font-weight: 650; color: var(--cos-ink-1); }
.tm-sidetitle small { display: block; font-size: 12px; color: var(--cos-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-sidebody { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 12px 24px; }
.tm-composer { margin-bottom: 14px; }
.tm-composerfoot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.tm-composerfoot small { font-size: 11.5px; color: var(--cos-ink-4); }
.tm-anchorchip, .tm-anchor { display: flex; align-items: flex-start; gap: 8px; width: 100%; margin: 0 0 8px; padding: 6px 8px 6px 10px; border: 0; border-left: 3px solid var(--cos-orange); border-radius: 0 var(--cos-radius-ctl) var(--cos-radius-ctl) 0; background: color-mix(in srgb, var(--cos-orange) 10%, transparent); color: var(--cos-ink-2); font: inherit; font-size: 12.5px; text-align: left; }
.tm-anchor { cursor: pointer; }
.tm-anchor:hover { background: color-mix(in srgb, var(--cos-orange) 18%, transparent); }
.tm-anchorchip q, .tm-anchor q { flex: 1; min-width: 0; quotes: none; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tm-line { flex: 0 0 auto; font-weight: 650; color: var(--cos-ink-2); font-variant-numeric: tabular-nums; }
.tm-anchorchip .tm-ibtn { width: 24px; height: 24px; margin: -3px -4px -3px 0; }
.tm-threads { display: flex; flex-direction: column; gap: 10px; }
.tm-thread { padding: 10px 10px 8px; border: 1px solid var(--cos-line-2); border-radius: var(--cos-radius-card); background: var(--cos-surface); }
.tm-thread.focus { border-color: var(--cos-accent); box-shadow: 0 0 0 2px var(--cos-accent-soft); }
.tm-thread.resolved { background: var(--cos-surface-2); }
.tm-thread.resolved .tm-cbody { color: var(--cos-ink-3); }
.tm-c { display: flex; gap: 9px; padding: 4px 0; }
.tm-c.reply { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--cos-line-3); }
.tm-cmain { flex: 1; min-width: 0; }
.tm-cmeta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 26px; }
.tm-cmeta b { font-weight: 600; font-size: 13.5px; color: var(--cos-ink-1); }
.tm-cmeta time, .tm-cmeta i { font-size: 12px; color: var(--cos-ink-3); font-style: normal; }
.tm-cacts { margin-left: auto; display: flex; gap: 0; opacity: .35; transition: opacity .12s ease-out; }
.tm-thread:hover .tm-cacts, .tm-cacts:focus-within { opacity: 1; }
@media (hover: none) { .tm-cacts { opacity: 1; } }
.tm-cbody { margin: 2px 0 0; font-size: 14px; color: var(--cos-text); overflow-wrap: anywhere; }
.tm-cbody.deleted { color: var(--cos-ink-4); font-style: italic; }
.tm-mention { color: var(--cos-accent); font-weight: 600; background: var(--cos-accent-soft); border-radius: 4px; padding: 0 3px; }
.tm-mention.agent { color: var(--cos-indigo); background: color-mix(in srgb, var(--cos-indigo) 14%, transparent); }
.tm-resolved { display: flex; align-items: center; gap: 5px; margin: 6px 0 0; font-size: 12px; color: var(--cos-green); }
.tm-working { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; font-size: 12.5px; color: var(--cos-indigo); }
.tm-replybox { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-top: 8px; }
.tm-replybox .tm-suggestwrap { width: 100%; }
.tm-reply { font-size: 14px; min-height: 36px; }
.tm-sendreply[hidden] { display: none; }
.tm-editacts { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }

/* ---------- activity ---------- */
.tm-feed li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--cos-line-3); }
.tm-feed li:last-child { border-bottom: 0; }
.tm-feedtxt { flex: 1; min-width: 0; font-size: 13.5px; color: var(--cos-ink-2); overflow-wrap: anywhere; }
.tm-feedtxt b { color: var(--cos-ink-1); font-weight: 600; }
.tm-feedtxt q { color: var(--cos-ink-3); }
.tm-feedtxt time, .tm-notetxt + q + time, .tm-note-row time { display: block; font-size: 12px; color: var(--cos-ink-3); margin-top: 1px; }

/* ---------- notifications popover ---------- */
.tm-pop { position: fixed; z-index: 330; max-height: min(72dvh, 560px); display: flex; flex-direction: column; background: var(--cos-surface); color: var(--cos-text); border: 1px solid var(--cos-line-1); border-radius: var(--cos-radius-card); box-shadow: var(--cos-shadow-pop); font-size: 14px; }
.tm-pophead { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 8px 14px; border-bottom: 1px solid var(--cos-line-2); }
.tm-pophead h2 { margin: 0; font-size: 15px; font-weight: 650; color: var(--cos-ink-1); }
.tm-popbody { overflow-y: auto; overscroll-behavior: contain; padding: 4px; }
.tm-note-row { width: 100%; display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; border-radius: var(--cos-radius-ctl); cursor: pointer; position: relative; }
.tm-note-row:hover { background: var(--cos-wash); }
.tm-note-row:disabled { opacity: .6; cursor: default; }
.tm-note-row > span { flex: 1; min-width: 0; }
.tm-note-row.unread { background: var(--cos-accent-softer, var(--cos-accent-soft)); }
.tm-note-row.unread::after { content: ''; position: absolute; right: 10px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--cos-accent); }
.tm-notetxt { display: block; font-size: 13.5px; color: var(--cos-ink-2); padding-right: 12px; }
.tm-notetxt b { color: var(--cos-ink-1); font-weight: 600; }
.tm-notesub { display: block; margin-top: 2px; font-size: 12px; color: var(--cos-accent); }
.tm-note-row q { display: block; margin-top: 2px; font-size: 12.5px; color: var(--cos-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- presence (editor header) ---------- */
.tm-presence { display: inline-flex; align-items: center; margin: 0 4px; }
.tm-pav { display: inline-flex; margin-left: -6px; border-radius: 50%; box-shadow: 0 0 0 2px var(--cos-surface); }
.tm-pav:first-child { margin-left: 0; }
.tm-pav.working .tm-av { animation: tm-pulse 1.6s ease-in-out infinite; }
@keyframes tm-pulse { 50% { opacity: .55; } }
.tm-pmore { margin-left: 4px; font-size: 11.5px; color: var(--cos-ink-3); }

/* ---------- a link opened while signed out ---------- */
.tm-linkpre { margin: 0; max-height: 52dvh; overflow: auto; padding: 12px; border: 1px solid var(--cos-line-2); border-radius: var(--cos-radius-ctl); background: var(--cos-surface-2); color: var(--cos-ink-1); font: 13px/1.55 'JetBrains Mono', 'Fira Code', ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .tm-ov { padding: 0; place-items: end stretch; }
  .tm-dlg { width: 100%; max-height: 92dvh; border-radius: var(--cos-radius-card) var(--cos-radius-card) 0 0; border-bottom: 0; }
  .tm-body { padding: 14px 16px 20px; }
  .tm-addrow { flex-wrap: wrap; }
  .tm-addrow .tm-suggestwrap, .tm-addrow > .tm-in { flex-basis: 100%; }
  .tm-addrow .tm-sel { flex: 1; }
  .tm-side { width: 100vw; border-left: 0; }
  .tm-btn, .tm-sel, .tm-ibtn { min-height: 44px; }
  .tm-ibtn { width: 44px; }
  .tm-x { width: 44px; height: 44px; }
  .tm-foot { flex-wrap: wrap; }
  .tm-prow .tm-pright .tm-sel { max-width: 130px; }
}
@media (prefers-reduced-motion: reduce) {
  .tm-side, .tm-spin, .tm-pav.working .tm-av { animation: none; }
}
