/* =====================================================================================================================
   owns.ai  -  THE TEAM PAGES  (js/team.js)

   /documents, /team, /team-assistant and /join. Built only from app.css tokens, so dark and light both hold. Every
   class here starts tm- so nothing collides with the dashboard or marketing stylesheets.

   Coded By Darko G.
   ===================================================================================================================== */

/* ---- SHARED ------------------------------------------------------------------------------------------------------- */

.tm-meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tm-meter { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.tm-meter-label { font-size: .84rem; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; }
.tm-meter-label i { color: var(--brand); }
.tm-meter-num { font-size: .86rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tm-meter-num b { color: var(--text); font-family: var(--font-display); font-size: 1.05rem; }
.tm-meter-sub { font-size: .78rem; color: var(--faint); }
.tm-meter-sub a { font-weight: 600; }

.tm-acc { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 2px; font-size: .74rem; font-weight: 700; white-space: nowrap; border: 1px solid; }
.tm-acc i { font-size: .8em; }
.tm-acc-private { color: #F59E0B; background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .28); }
.tm-acc-team { color: var(--brand); background: rgba(0, 155, 219, .1); border-color: rgba(0, 155, 219, .3); }
.tm-acc-public { color: var(--success); background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .28); }
.tm-acc-web { color: var(--info); background: rgba(56, 189, 248, .1); border-color: rgba(56, 189, 248, .28); }

.tm-danger { color: var(--danger) !important; }
.tm-danger:hover { background: rgba(244, 63, 94, .1) !important; border-color: rgba(244, 63, 94, .3) !important; }

.tm-empty { text-align: center; padding: 48px 24px 52px; color: var(--muted); }
.tm-empty .empty-icon { width: 66px; height: 66px; margin: 0 auto 16px; border-radius: 4px; display: grid; place-items: center; background: var(--grad-soft); color: var(--brand); font-size: 1.6rem; }
.tm-empty h3 { color: var(--text); margin-bottom: 8px; }
.tm-empty p { max-width: 560px; margin: 0 auto 20px; }
.tm-empty-sm { padding: 30px 20px; }
.tm-empty-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 760px; margin: 0 auto 24px; text-align: left; }
.tm-empty-levels > div { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); font-size: .85rem; color: var(--text-2); }

.tm-limit { text-align: center; padding: 6px 0 4px; }
.tm-limit-icon { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 4px; display: grid; place-items: center; background: var(--grad); color: #fff; font-size: 1.4rem; box-shadow: var(--glow); }
.tm-limit p { color: var(--text-2); margin: 0; }

.tm-av { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 800; font-size: .84rem; flex: none; letter-spacing: .02em; box-shadow: 0 0 0 2px var(--surface); }
.tm-av-ghost { background: var(--surface-3); color: var(--muted); font-size: .9rem; }

/* ---- /documents ----------------------------------------------------------------------------------------------------- */

.tm-upload { margin-top: 18px; padding: 18px; }
.tm-upload-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.tm-upload-zone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; min-height: 230px;
                  padding: 26px 22px; border-radius: var(--r-lg); border: 2px dashed var(--border-strong); cursor: pointer; overflow: hidden;
                  background: radial-gradient(420px 180px at 50% 0%, rgba(0, 155, 219, .1), transparent 70%), var(--surface-2);
                  transition: border-color .25s, background .25s, transform .25s var(--ease); }
.tm-upload-zone:hover { border-color: rgba(0, 155, 219, .55); }
.tm-upload-zone:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.tm-upload-zone.is-over { border-color: var(--brand); border-style: solid; transform: scale(1.01); background: radial-gradient(500px 220px at 50% 30%, rgba(0, 155, 219, .26), transparent 70%), var(--surface-2); }
.tm-upload-zone.is-over .tm-upload-orb { transform: translateY(-6px) scale(1.08); }
.tm-upload-zone.is-busy { pointer-events: none; }
.tm-upload-zone h3 { font-size: 1.12rem; margin: 10px 0 2px; }
.tm-upload-zone p { color: var(--muted); font-size: .9rem; margin: 0; max-width: 420px; }
.tm-upload-orb { width: 66px; height: 66px; border-radius: 4px; display: grid; place-items: center; background: var(--grad); color: #fff; font-size: 1.6rem;
                 box-shadow: var(--glow), 0 18px 40px -16px rgba(0, 212, 170, .7); transition: transform .35s var(--ease); animation: tm-bob 4s ease-in-out infinite; }
@keyframes tm-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.tm-upload-progress { width: min(360px, 100%); margin-top: 16px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.tm-upload-note { margin-top: 14px; text-align: left; width: 100%; }
.tm-upload-side { display: flex; flex-direction: column; gap: 10px; }

.tm-access-pick { display: flex; flex-direction: column; gap: 8px; }
.tm-access-opt { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface);
                 color: var(--text-2); text-align: left; font: inherit; cursor: pointer; transition: border-color .2s, background .2s, box-shadow .2s; }
.tm-access-opt > i { width: 30px; height: 30px; border-radius: 3px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: none; margin-top: 1px; transition: all .2s; }
.tm-access-opt span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tm-access-opt b { color: var(--text); font-size: .9rem; }
.tm-access-opt small { color: var(--muted); font-size: .78rem; line-height: 1.4; }
.tm-access-opt:hover { border-color: var(--border-strong); }
.tm-access-opt.is-active { border-color: rgba(0, 155, 219, .6); background: var(--grad-soft); box-shadow: 0 0 0 3px rgba(0, 155, 219, .12); }
.tm-access-opt.is-active > i { background: var(--grad); color: #fff; }
.tm-access-opt[data-access="private"].is-active > i { background: linear-gradient(135deg, #F59E0B, #F97316); }
.tm-access-opt[data-access="public"].is-active > i { background: linear-gradient(135deg, #22C55E, #10B981); }
.tm-access-opt.is-locked { opacity: .5; cursor: not-allowed; }
.tm-access-pick.is-compact { flex-direction: row; }
.tm-access-pick.is-compact .tm-access-opt { flex: 1; flex-direction: column; gap: 8px; }

.tm-library { margin-top: 18px; overflow: hidden; }
.tm-library-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.tm-chip-n { font-size: .74rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.chip.is-active .tm-chip-n { color: var(--text-2); }
.tm-search { position: relative; width: min(280px, 100%); }
.tm-search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: .85rem; pointer-events: none; }
.tm-search .input { padding-left: 36px; min-height: 38px; }

.tm-doc { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 150px auto; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border);
          transition: background .15s; animation: tm-row-in .4s var(--ease) both; }
@keyframes tm-row-in { from { opacity: 0; transform: translateY(6px); } }
.tm-doc:last-child { border-bottom: 0; }
.tm-doc:hover { background: var(--surface-2); }
.tm-doc-icon { width: 42px; height: 42px; border-radius: 3px; display: grid; place-items: center; font-size: 1.15rem; flex: none; }
.tm-doc-icon.is-pdf { background: rgba(244, 63, 94, .12); color: #F43F5E; }
.tm-doc-icon.is-word { background: rgba(59, 130, 246, .13); color: #3B82F6; }
.tm-doc-icon.is-excel { background: rgba(34, 197, 94, .13); color: #22C55E; }
.tm-doc-icon.is-ppt { background: rgba(249, 115, 22, .13); color: #F97316; }
.tm-doc-icon.is-image { background: rgba(236, 72, 153, .12); color: #EC4899; }
.tm-doc-icon.is-code { background: rgba(56, 189, 248, .12); color: #38BDF8; }
.tm-doc-icon.is-text { background: var(--surface-3); color: var(--text-2); }
.tm-doc-icon.is-article { background: var(--grad-soft); color: var(--brand); }
.tm-doc-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.tm-doc-title { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-doc-main:hover .tm-doc-title { color: var(--brand); }
.tm-doc-meta { font-size: .8rem; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-doc-error { font-size: .78rem; color: var(--danger); white-space: normal; }
.tm-doc-access { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.tm-doc-scope { font-size: .72rem; color: var(--faint); }
.tm-doc-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }

.tm-status { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.tm-status.is-ready { color: var(--success); }
.tm-status.is-failed { color: var(--danger); }
.tm-status.is-busy { color: var(--brand); }
.tm-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 rgba(0, 155, 219, .6); animation: tm-pulse 1.4s infinite; }
@keyframes tm-pulse { 0% { box-shadow: 0 0 0 0 rgba(0, 155, 219, .55); } 70% { box-shadow: 0 0 0 9px rgba(0, 155, 219, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 155, 219, 0); } }
.tm-doc.is-processing .tm-doc-icon, .tm-doc.is-queued .tm-doc-icon { position: relative; overflow: hidden; }
.tm-doc.is-processing .tm-doc-icon::after, .tm-doc.is-queued .tm-doc-icon::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent); animation: skeleton 1.3s infinite; }

.tm-viewer-head { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.tm-viewer-body { margin-top: 16px; max-height: 58vh; overflow-y: auto; padding: 18px 20px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); font-size: .92rem; line-height: 1.7; color: var(--text-2); }
.tm-viewer-body h1, .tm-viewer-body h2, .tm-viewer-body h3 { font-size: 1.05rem; margin: 1em 0 .4em; }

.tm-editor-tabs { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.tm-editor-tabs button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 3px; font: 600 .85rem var(--font-display); cursor: pointer; display: inline-flex; gap: 7px; align-items: center; }
.tm-editor-tabs button.is-active { background: var(--surface-2); color: var(--text); }
.tm-editor-hint { margin-left: auto; font-size: .76rem; color: var(--faint); }
.tm-editor { min-height: 260px; font-family: var(--font-mono); font-size: .88rem; line-height: 1.65; }
.tm-editor-preview { min-height: 260px; max-height: 50vh; overflow-y: auto; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); }
.tm-editor-count { text-align: right; margin-top: 4px; }

/* ---- /team ------------------------------------------------------------------------------------------------------------ */

.tm-seats { display: flex; align-items: center; gap: 22px; padding: 18px 22px; flex-wrap: wrap; }
.tm-seats .grow { display: flex; flex-direction: column; gap: 9px; min-width: 220px; }
.tm-seats-avatars { display: flex; padding-left: 8px; }
.tm-seats-avatars .tm-av { margin-left: -10px; width: 42px; height: 42px; box-shadow: 0 0 0 3px var(--surface); }
.tm-table td { vertical-align: middle; }
.tm-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tm-person-name { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tm-person-email { font-size: .82rem; color: var(--faint); word-break: break-all; }
.tm-role-select { min-height: 36px; width: 128px; padding-top: 6px; padding-bottom: 6px; font-size: .86rem; }
.tm-invite { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tm-invite:last-child { border-bottom: 0; }
.tm-roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tm-role-card { padding: 20px; }
.tm-role-card h4 { margin: 12px 0 6px; }
.tm-role-card p { color: var(--muted); font-size: .88rem; margin: 0; }
.tm-role-icon { width: 40px; height: 40px; border-radius: 3px; display: grid; place-items: center; font-size: 1.05rem; }
.tm-role-icon.is-owner { background: var(--grad); color: #fff; }
.tm-role-icon.is-admin { background: rgba(0, 155, 219, .14); color: var(--brand); }
.tm-role-icon.is-member { background: var(--surface-3); color: var(--text-2); }
.tm-role-pick { display: flex; flex-direction: column; gap: 8px; }
.tm-role-opt { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--border); cursor: pointer; transition: all .2s; }
.tm-role-opt input { position: absolute; opacity: 0; pointer-events: none; }
.tm-role-opt > i { width: 30px; height: 30px; border-radius: 3px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: none; }
.tm-role-opt span { display: flex; flex-direction: column; gap: 2px; }
.tm-role-opt b { color: var(--text); font-size: .9rem; }
.tm-role-opt small { color: var(--muted); font-size: .8rem; }
.tm-role-opt.is-active { border-color: rgba(0, 155, 219, .6); background: var(--grad-soft); }
.tm-role-opt.is-active > i { background: var(--grad); color: #fff; }
.tm-role-opt.is-locked { opacity: .5; cursor: not-allowed; }
.tm-inv-ok { text-align: center; margin-bottom: 18px; }
.tm-inv-ok-icon { width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 4px; display: grid; place-items: center; background: linear-gradient(135deg, #22C55E, #10B981); color: #fff; font-size: 1.3rem;
                  animation: tm-pop .5s var(--ease) both; }
@keyframes tm-pop { from { transform: scale(.5); opacity: 0; } }
.tm-inv-ok h4 { margin-bottom: 4px; }

/* ---- /team-assistant ------------------------------------------------------------------------------------------------- */

.tm-chat-main { padding: 0 !important; }
.tm-app { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: calc(100vh - var(--nav-h)); min-height: 520px; position: relative; }
.tm-history { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: color-mix(in srgb, var(--bg-2) 55%, transparent); }
.tm-history-head { padding: 16px; border-bottom: 1px solid var(--border); }
.tm-history-list { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }
.tm-sk-row { height: 38px; margin: 8px 4px; border-radius: 3px; }
.tm-history-group { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 700; padding: 14px 10px 6px; }
.tm-history-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 3px; color: var(--text-2); font-size: .88rem; cursor: pointer; transition: background .15s, color .15s; }
.tm-history-item > i { color: var(--faint); font-size: .85rem; flex: none; }
.tm-history-item:hover { background: var(--surface-2); color: var(--text); }
.tm-history-item.is-active { background: var(--grad-soft); color: var(--text); box-shadow: inset 0 0 0 1px rgba(0, 155, 219, .25); }
.tm-history-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-history-del { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 4px 6px; border-radius: 3px; opacity: 0; transition: opacity .15s, color .15s; }
.tm-history-item:hover .tm-history-del, .tm-history-item.is-active .tm-history-del { opacity: 1; }
.tm-history-del:hover { color: var(--danger); }
.tm-history-empty { text-align: center; color: var(--faint); padding: 40px 18px; font-size: .86rem; }
.tm-history-empty i { font-size: 1.6rem; margin-bottom: 10px; display: block; color: var(--muted); }

.tm-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tm-chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(12px); }
.tm-history-toggle { display: none; }
.tm-bot-face { width: 40px; height: 40px; border-radius: 3px; display: grid; place-items: center; color: #fff; font-size: 1.15rem; background: var(--grad); box-shadow: var(--glow); flex: none; }
.tm-bot-name { font-family: var(--font-display); font-weight: 800; font-size: 1.02rem; color: var(--text); }
.tm-bot-sub { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 7px; }

.tm-thread { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.tm-thread-inner { max-width: 820px; margin: 0 auto; padding: 28px 24px 18px; display: flex; flex-direction: column; gap: 20px; }

.tm-welcome { text-align: center; padding: 6vh 0 10px; animation: tm-row-in .6s var(--ease) both; }
.tm-welcome-face { width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 4px; display: grid; place-items: center; color: #fff; font-size: 2rem;
                   box-shadow: 0 20px 50px -18px rgba(0, 155, 219, .8), inset 0 0 0 1px rgba(255, 255, 255, .2); animation: tm-bob 5s ease-in-out infinite; }
.tm-welcome h2 { font-size: 1.7rem; margin-bottom: 8px; }
.tm-welcome-greet { color: var(--text-2); max-width: 560px; margin: 0 auto 18px; font-size: 1.02rem; }
.tm-know { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 26px; }
.tm-know span { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--border); font-size: .8rem; color: var(--text-2); }
.tm-know i { color: var(--brand); }
.tm-starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 640px; margin: 0 auto; }
.tm-starter { display: flex; align-items: center; gap: 10px; text-align: left; padding: 13px 15px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface);
              color: var(--text-2); font: inherit; font-size: .9rem; cursor: pointer; transition: border-color .2s, transform .2s var(--ease), color .2s; }
.tm-starter i { color: var(--brand); flex: none; }
.tm-starter:hover { border-color: rgba(0, 155, 219, .5); color: var(--text); transform: translateY(-2px); }

.tm-msg { display: flex; gap: 12px; animation: tm-row-in .35s var(--ease) both; }
.tm-msg.is-user { justify-content: flex-end; }
.tm-msg.is-user .tm-bub { max-width: 78%; padding: 11px 16px; border-radius: 4px 4px 3px 4px; background: var(--grad); color: #fff; box-shadow: 0 10px 26px -14px rgba(0, 155, 219, .9); white-space: normal; word-wrap: break-word; }
.tm-msg.is-bot .tm-bub { flex: 1; min-width: 0; padding-top: 6px; color: var(--text-2); line-height: 1.7; }
.tm-msg-face { width: 32px; height: 32px; border-radius: 3px; display: grid; place-items: center; color: #fff; font-size: .9rem; flex: none; }
.tm-text { font-size: .96rem; }
.tm-text strong { color: var(--text); }
.tm-typing { display: inline-flex; gap: 5px; padding: 8px 0; }
.tm-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: tm-dot 1.2s infinite ease-in-out; }
.tm-typing i:nth-child(2) { animation-delay: .15s; } .tm-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes tm-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-5px); opacity: 1; } }
.tm-error { color: var(--danger); font-size: .9rem; }

.tm-extra { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.tm-extra > * { animation: tm-row-in .45s var(--ease) both; }
.tm-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tm-sources-label { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 700; margin-right: 4px; }
.tm-source { display: inline-flex; align-items: center; gap: 7px; max-width: 280px; padding: 5px 11px; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--border);
             color: var(--text-2); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-source i { color: var(--brand); font-size: .75rem; }
.tm-source:hover { border-color: rgba(0, 155, 219, .5); color: var(--text); }
.tm-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-suggest .chip { font-size: .83rem; padding: 6px 13px; }
.tm-msg-actions { display: flex; align-items: center; gap: 10px; }
.tm-icon-btn { border: 1px solid transparent; background: none; color: var(--faint); cursor: pointer; padding: 5px 8px; border-radius: 3px; font-size: .82rem; transition: all .15s; }
.tm-icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.tm-gap { font-size: .78rem; color: var(--warning); display: inline-flex; align-items: center; gap: 6px; }
.tm-debug { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); font-size: .84rem; }
.tm-debug summary { cursor: pointer; padding: 9px 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
.tm-debug summary::-webkit-details-marker { display: none; }
.tm-debug summary:hover { color: var(--text); }
.tm-debug-list { padding: 4px 13px 12px; display: flex; flex-direction: column; gap: 12px; }
.tm-debug-title { font-weight: 600; color: var(--text); font-size: .84rem; }
.tm-debug-bar { height: 4px; border-radius: 2px; background: var(--surface-3); margin: 6px 0; overflow: hidden; }
.tm-debug-bar span { display: block; height: 100%; background: var(--grad); border-radius: inherit; }
.tm-debug-text { color: var(--faint); font-size: .78rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.tm-composer { padding: 10px 24px 18px; background: linear-gradient(180deg, transparent, var(--bg) 35%); }
.tm-composer-box { max-width: 820px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; padding: 9px 9px 9px 18px; border-radius: 4px;
                   background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow); transition: border-color .2s, box-shadow .2s; }
.tm-composer-box:hover { border-color: rgba(0, 155, 219, .45); box-shadow: 0 0 24px -8px rgba(0, 155, 219, .45), var(--shadow); }
.tm-composer-box:focus-within { border-color: transparent; box-shadow: var(--field-glow), var(--shadow);
                                background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box; }
.tm-composer textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: inherit; font-size: .96rem; line-height: 1.5; padding: 8px 0; max-height: 200px; min-height: 24px; }
.tm-composer textarea::placeholder { color: var(--faint); }
.tm-send { width: 42px; height: 42px; border-radius: 3px; border: 0; background: var(--grad); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none;
           box-shadow: var(--glow); transition: transform .2s var(--ease), filter .2s; }
.tm-send:hover { transform: translateY(-1px); filter: brightness(1.08); }
.tm-send.is-stop { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.tm-composer-foot { max-width: 820px; margin: 8px auto 0; display: flex; justify-content: space-between; gap: 12px; font-size: .74rem; color: var(--faint); padding: 0 6px; }

.tm-set-tabs { margin-top: -4px; }
.tm-theme-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tm-theme-opt { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 3px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
                font: 600 .85rem var(--font-display); cursor: pointer; transition: all .2s; }
.tm-theme-opt.is-active { border-color: rgba(0, 155, 219, .65); background: var(--grad-soft); color: var(--text); }
.tm-theme-swatch { width: 22px; height: 22px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.tm-th-aurora .tm-theme-swatch { background: linear-gradient(135deg, #7C6BFF, #FF5C8A); }
.tm-th-minimal .tm-theme-swatch { background: linear-gradient(135deg, #FFFFFF 50%, #111113 50%); }
.tm-th-midnight .tm-theme-swatch { background: #0B0D12; box-shadow: inset 0 0 0 2px #7C6BFF; }
.tm-th-bubble .tm-theme-swatch { background: linear-gradient(135deg, #FFF6FB, #C4B5FD); border-radius: 50%; }
.tm-th-executive .tm-theme-swatch { background: linear-gradient(180deg, #1E3A5F 50%, #F8F7F4 50%); }
.tm-th-sunset .tm-theme-swatch { background: linear-gradient(135deg, #FF8A4C, #FF5C8A); }
.tm-th-forest .tm-theme-swatch { background: linear-gradient(135deg, #1D4A31 55%, #F5F4EC 55%); }
.tm-th-graphite .tm-theme-swatch { background: linear-gradient(135deg, #1D1D21 55%, #EDEDEF 55%); }
.tm-th-latte .tm-theme-swatch { background: linear-gradient(135deg, #6F4E37 50%, #F1E8DC 50%); border-radius: 50%; }
.tm-th-lagoon .tm-theme-swatch { background: linear-gradient(135deg, #00A6A6, #009BDB); border-radius: 50%; }
.tm-tp-opt i { width: 22px; text-align: center; font-size: 1rem; color: var(--muted); flex: none; }
.tm-tp-opt.is-active i { color: var(--brand); }

/* ---- /join --------------------------------------------------------------------------------------------------------------- */

.tm-join { position: relative; min-height: calc(100vh - var(--nav-h)); display: flex; align-items: center; justify-content: center; padding: 48px 20px; overflow: hidden; }
.tm-join-glow { position: absolute; width: 640px; height: 640px; border-radius: 50%; background: radial-gradient(circle, rgba(0, 155, 219, .3), transparent 65%); filter: blur(30px); pointer-events: none; }
.tm-join-card { position: relative; width: 100%; max-width: 480px; padding: 38px 34px; text-align: center; box-shadow: var(--shadow-lg); }
.tm-join-card h1 { font-size: 1.85rem; margin-bottom: 8px; }
.tm-join-icon { width: 66px; height: 66px; margin: 0 auto 16px; border-radius: 4px; display: grid; place-items: center; background: var(--grad); color: #fff; font-size: 1.6rem; box-shadow: var(--glow); animation: tm-pop .55s var(--ease) both; }
.tm-join-icon.is-muted { background: var(--surface-3); color: var(--muted); box-shadow: none; }
.tm-join-perks { list-style: none; padding: 0; margin: 20px 0 22px; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.tm-join-perks li { display: flex; gap: 12px; align-items: flex-start; font-size: .9rem; color: var(--text-2); }
.tm-join-perks i { color: var(--brand); margin-top: 4px; width: 16px; text-align: center; }
.tm-join-form { text-align: left; }
.tm-pw { position: relative; }
.tm-pw .input { padding-right: 46px; }
.tm-pw .pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--faint); cursor: pointer; padding: 8px; }
.tm-join-as { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .9rem; color: var(--text-2); margin-bottom: 14px; }
.tm-join-as i { color: var(--success); }

/* ---- RESPONSIVE ----------------------------------------------------------------------------------------------------- */

@media (max-width: 1100px) {
    .tm-doc { grid-template-columns: 44px minmax(0, 1fr) auto auto; }
    .tm-doc-status { grid-column: 2; grid-row: 2; margin-top: -6px; }
}

@media (max-width: 980px) {
    .tm-app { grid-template-columns: minmax(0, 1fr); height: calc(100vh - var(--nav-h) - 58px); }
    .tm-history { position: absolute; z-index: 20; inset: 0 auto 0 0; width: min(300px, 86vw); background: var(--bg); transform: translateX(-102%); transition: transform .35s var(--ease); box-shadow: var(--shadow-lg); }
    .tm-app.show-history .tm-history { transform: none; }
    .tm-history-toggle { display: inline-flex; }
}

@media (max-width: 760px) {
    .tm-meters, .tm-roles, .tm-empty-levels { grid-template-columns: minmax(0, 1fr); }
    .tm-upload-grid { grid-template-columns: minmax(0, 1fr); }
    .tm-upload-zone { min-height: 190px; }
    .tm-access-pick.is-compact { flex-direction: column; }
    .tm-access-pick.is-compact .tm-access-opt { flex-direction: row; }
    .tm-doc { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; padding: 12px 14px; }
    .tm-doc-access { grid-column: 2; grid-row: 2; flex-direction: row; align-items: center; }
    .tm-doc-status { grid-column: 2; grid-row: 3; margin-top: 0; }
    .tm-doc-actions { grid-column: 3; grid-row: 1 / span 3; flex-direction: column; }
    .tm-library-bar { padding: 14px; }
    .tm-search { width: 100%; }
    .tm-starters { grid-template-columns: minmax(0, 1fr); }
    .tm-thread-inner { padding: 20px 14px 12px; }
    .tm-composer { padding: 8px 12px 12px; }
    .tm-chat-head { padding: 12px 14px; }
    .tm-msg.is-user .tm-bub { max-width: 88%; }
    .tm-hide-sm { display: none; }
    .tm-theme-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tm-join-card { padding: 30px 22px; }
    .tm-seats { gap: 14px; }
    .tm-table th:nth-child(4), .tm-table td:nth-child(4) { display: none; }
}

/* A one-row composer must never show a wrapped, half-clipped placeholder on a narrow phone. */
.tm-composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Avatar icon in the team assistant's settings (the picker itself is .icp-*, styled in dashboard.css). */
.tm-icon-now { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.tm-icon-face { width: 44px; height: 44px; border-radius: 3px; display: grid; place-items: center; color: #fff; font-size: 1.15rem; flex: none; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .5); }

/* The team assistant's avatar shape (its settings' "Look & feel"), on every face on the page */
[data-shape="circle"] :is(.tm-bot-face, .tm-welcome-face, .tm-msg-face) { border-radius: 50%; }
[data-shape="square"] :is(.tm-bot-face, .tm-welcome-face, .tm-msg-face) { border-radius: 2px; }
[data-shape="rounded"] :is(.tm-bot-face, .tm-welcome-face, .tm-msg-face) { border-radius: 4px; }
[data-shape="hex"] :is(.tm-bot-face, .tm-welcome-face, .tm-msg-face) { border-radius: 0; clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); }
