/* TechFace.NET v2.1 interface layer (loaded after app.css).
   Composer, viewers, Messenger-style chat, pop-ups, profile media & links, mobile polish. Light + dark. */
:root {
  --tf-blue: #1877f2; --tf-blue-d: #0b5ed7; --tf-violet: #7c3aed;
  --tf-grad: linear-gradient(135deg, #1877f2 0%, #6d4aff 100%);
  --tf-bg: #f0f2f5; --tf-card: #fff; --tf-text: #0f172a; --tf-muted: #65676b; --tf-line: #e4e6eb; --tf-hover: #f2f3f5; --tf-soft: #f0f2f5;
  --tf-them: #e9ebef; --tf-me: linear-gradient(135deg, #1a7cff 0%, #5b5cf6 100%);
  --tf-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 10px rgba(16, 24, 40, .05);
  --tf-shadow-lg: 0 12px 40px rgba(16, 24, 40, .22);
  --tf-ease: cubic-bezier(.2, .8, .2, 1);
}
html.dark {
  --tf-bg: #0b1220; --tf-card: #111a2e; --tf-text: #e5e9f0; --tf-muted: #9aa4b5; --tf-line: #1f2a40; --tf-hover: #18233a; --tf-soft: #18233a;
  --tf-them: #22304a; --tf-shadow: 0 1px 2px rgba(0, 0, 0, .4); --tf-shadow-lg: 0 16px 48px rgba(0, 0, 0, .6);
}
[hidden] { display: none !important; }
html.tf-lock, html.tf-lock body { overflow: hidden; }
body { background: var(--tf-bg) !important; -webkit-tap-highlight-color: transparent; }
::selection { background: rgba(24, 119, 242, .25); }

/* ---------- global polish ---------- */
.card { border-radius: 14px; border-color: var(--tf-line); box-shadow: var(--tf-shadow); }
html.dark .card { background: var(--tf-card); border-color: var(--tf-line); }
header.sticky { box-shadow: 0 1px 0 var(--tf-line), 0 4px 18px rgba(16, 24, 40, .04); }
.btn { transition: transform .12s var(--tf-ease), background-color .15s, box-shadow .15s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-primary { background: var(--tf-blue); box-shadow: 0 1px 2px rgba(24, 119, 242, .25); }
.btn-primary:hover:not(:disabled) { background: var(--tf-blue-d); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.toast { border-radius: 14px; animation: tf-slide-in .28s var(--tf-ease); backdrop-filter: blur(8px); }
article.card { transition: box-shadow .2s; }
article.card:hover { box-shadow: 0 2px 4px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .07); }
article.tf-new { animation: tf-glow 2.2s ease-out; }
@keyframes tf-glow { 0% { box-shadow: 0 0 0 3px rgba(24, 119, 242, .55); } 100% { box-shadow: var(--tf-shadow); } }
@keyframes tf-slide-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes tf-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* header "Post" button + mobile floating button */
.tf-create { align-items: center; gap: .35rem; margin-left: .5rem; padding: .5rem .95rem; border-radius: 999px; font-weight: 800; font-size: .875rem;
  color: #fff; background: var(--tf-grad); box-shadow: 0 4px 14px rgba(24, 119, 242, .35); transition: transform .15s var(--tf-ease), box-shadow .15s; }
.tf-create:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(24, 119, 242, .45); }
.tf-tab-post { color: var(--tf-blue); }
.tf-fab { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-top: -20px; border-radius: 50%;
  color: #fff; background: var(--tf-grad); box-shadow: 0 6px 18px rgba(24, 119, 242, .45); border: 3px solid var(--tf-card); transition: transform .15s; }
.tf-tab-post:active .tf-fab { transform: scale(.92); }
nav[aria-label="Mobile"] { box-shadow: 0 -4px 18px rgba(16, 24, 40, .06); }

/* ---------- "Start a post" card ---------- */
@media (max-width: 1023px) { main > .grid.lg\:grid-cols-12 { grid-template-columns: minmax(0, 1fr); } }
.tf-start { padding: .85rem 1rem .5rem; }
.tf-start-row { display: flex; align-items: center; gap: .7rem; }
.tf-start { min-width: 0; }
.tf-start-input { flex: 1; min-width: 0; text-align: left; padding: .8rem 1.1rem; border-radius: 999px; border: 1px solid var(--tf-line); background: var(--tf-card);
  color: var(--tf-muted); font-weight: 600; font-size: .95rem; transition: background .15s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-start-input:hover { background: var(--tf-hover); }
.tf-start-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; margin-top: .55rem; padding-top: .45rem; border-top: 1px solid var(--tf-line); }
.tf-start-tools button { display: flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem .25rem; border-radius: 10px;
  font-weight: 700; font-size: .875rem; color: var(--tf-muted); transition: background .15s; }
.tf-start-tools button:hover { background: var(--tf-hover); }
.tool-photo svg { color: #45bd62; } .tool-video svg { color: #f3425f; } .tool-doc svg { color: #f59f0b; } .tool-code svg { color: #8b5cf6; } .tool-emoji svg { color: #f7b928; }
@media (max-width: 420px) { .tf-start-tools span { font-size: .75rem; } .tf-start-tools button { flex-direction: column; gap: .15rem; } }

/* ---------- modal shell (composer) ---------- */
.tfm { position: fixed; inset: 0; z-index: 85; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.tfm-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s; }
.tfm-dialog { position: relative; width: min(100%, 580px); max-height: min(92vh, 860px); display: flex; flex-direction: column; background: var(--tf-card); color: var(--tf-text);
  border-radius: 18px; box-shadow: var(--tf-shadow-lg); opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .2s var(--tf-ease), transform .25s var(--tf-ease); }
.tfm.is-open .tfm-backdrop { opacity: 1; } .tfm.is-open .tfm-dialog { opacity: 1; transform: none; }
.tfm-head { position: relative; display: flex; align-items: center; justify-content: center; padding: .9rem 3rem; border-bottom: 1px solid var(--tf-line); }
.tfm-head h2 { font-size: 1.15rem; font-weight: 800; }
.tfm-x { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--tf-soft); color: var(--tf-muted); transition: background .15s; }
.tfm-x:hover { background: var(--tf-line); }
.tfm-body { position: relative; overflow-y: auto; padding: 1rem 1.1rem .5rem; flex: 1; overscroll-behavior: contain; }
.tfm-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .7rem 1.1rem 1rem; position: relative; }
@media (max-width: 640px) {
  .tfm { padding: 0; align-items: stretch; }
  .tfm-dialog { width: 100%; max-height: none; height: 100dvh; border-radius: 0; transform: translateY(24px); }
  .tfm-foot { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
  .tfc-post { flex-basis: 100%; }
}

/* ---------- composer ---------- */
.tfc-author { display: flex; align-items: center; gap: .7rem; margin-bottom: .6rem; }
.tfc-name { display: block; font-weight: 800; }
.tfc-pills { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .25rem; }
.tfc-pill { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: 8px; background: var(--tf-soft); color: var(--tf-text); font-size: .78rem; font-weight: 700; }
.tfc-pill select { background: transparent; border: 0; outline: 0; font-weight: 700; color: inherit; padding: 0 .1rem; cursor: pointer; }
html.dark .tfc-pill select option { background: var(--tf-card); }
.tfc-group { background: rgba(124, 58, 237, .12); color: #7c3aed; }
.tfc-text { width: 100%; border: 0; outline: 0; resize: none; background: transparent; color: var(--tf-text); font-size: 1.2rem; line-height: 1.5; min-height: 120px; padding: .25rem 0; }
.tfc-text::placeholder { color: var(--tf-muted); }
.tfc-media.has-items { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; margin-top: .5rem; padding: .45rem; border: 1px solid var(--tf-line); border-radius: 14px; }
.tfc-media[data-count="1"] .tfc-image:first-child { grid-column: 1 / -1; aspect-ratio: auto; max-height: 340px; }
.tfc-item { position: relative; border-radius: 10px; overflow: hidden; background: var(--tf-soft); aspect-ratio: 1; animation: tf-fade .25s; }
.tfc-item img, .tfc-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tfc-video { grid-column: 1 / -1; aspect-ratio: 16 / 9; background: #000; }
.tfc-video video { object-fit: contain; }
.tfc-doc { grid-column: 1 / -1; aspect-ratio: auto; display: flex; align-items: center; gap: .7rem; padding: .6rem 2.6rem .6rem .6rem; }
.tfc-doc-meta { min-width: 0; display: flex; flex-direction: column; } .tfc-doc-meta b { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .tfc-doc-meta small { color: var(--tf-muted); }
.tfc-dur { position: absolute; left: .45rem; bottom: .45rem; display: inline-flex; align-items: center; gap: .15rem; padding: .15rem .45rem; border-radius: 999px; background: rgba(0, 0, 0, .65); color: #fff; font-size: .72rem; font-weight: 700; }
.tfc-rm { position: absolute; top: .35rem; right: .35rem; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .92); color: #111; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.tfc-doc .tfc-rm { top: 50%; transform: translateY(-50%); }
.tfc-drop { position: absolute; inset: .5rem; border: 2px dashed var(--tf-blue); border-radius: 14px; background: rgba(24, 119, 242, .08); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .5rem; color: var(--tf-blue); font-weight: 800; z-index: 3; }
.tfc-emoji { display: grid; grid-template-columns: repeat(12, 1fr); gap: .1rem; margin: 0 1.1rem .4rem; padding: .4rem; border: 1px solid var(--tf-line); border-radius: 12px; animation: tf-fade .15s; }
.tfc-emoji button, .tfchat-emoji button { font-size: 1.35rem; line-height: 1; padding: .3rem 0; border-radius: 8px; transition: transform .1s, background .1s; }
.tfc-emoji button:hover, .tfchat-emoji button:hover { background: var(--tf-hover); transform: scale(1.18); }
@media (max-width: 640px) { .tfc-emoji { grid-template-columns: repeat(8, 1fr); } }
.tfc-add { display: flex; align-items: center; gap: .15rem; margin: .2rem 1.1rem 0; padding: .45rem .55rem .45rem .9rem; border: 1px solid var(--tf-line); border-radius: 12px; }
.tfc-add-label { font-weight: 700; font-size: .9rem; margin-right: auto; }
.tfc-tool { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; transition: background .15s, transform .1s; }
.tfc-tool span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tfc-tool:hover { background: var(--tf-hover); } .tfc-tool:active { transform: scale(.92); }
@media (max-width: 400px) { .tfc-add-label { display: none; } .tfc-add { justify-content: space-around; } }
.tfc-hint { color: var(--tf-muted); font-size: .75rem; margin-right: auto; }
.tfc-hint.is-err { color: #dc2626; font-weight: 700; }
.tfc-count { color: var(--tf-muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.tfc-post { min-width: 7rem; padding: .6rem 1.2rem; border-radius: 10px; }
.tfc-progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--tf-line); overflow: hidden; }
.tfc-progress span { display: block; height: 100%; width: 2%; background: var(--tf-grad); transition: width .2s; }
#composer-form.is-sending .tfm-body { opacity: .65; pointer-events: none; }

/* ---------- post media ---------- */
.tf-grid { display: grid; gap: 3px; border-radius: 12px; overflow: hidden; border: 1px solid var(--tf-line); background: var(--tf-line); }
.tf-grid-cell { position: relative; display: block; overflow: hidden; background: var(--tf-soft); cursor: zoom-in; }
.tf-grid-cell img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s var(--tf-ease); }
.tf-grid-cell:hover img { transform: scale(1.025); }
.tf-grid-1 .tf-grid-cell img { height: auto; max-height: 620px; object-fit: cover; }
.tf-grid-2 { grid-template-columns: 1fr 1fr; } .tf-grid-2 .tf-grid-cell { aspect-ratio: 4 / 5; }
.tf-grid-3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 1 / .85; }
.tf-grid-3 .tf-grid-cell:first-child { grid-row: span 2; }
.tf-grid-4 { grid-template-columns: 1fr 1fr; } .tf-grid-4 .tf-grid-cell { aspect-ratio: 1; }
.tf-grid-more { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); color: #fff; font-size: 1.8rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.tf-atts { display: flex; flex-direction: column; gap: .5rem; }
.tf-video { border-radius: 12px; overflow: hidden; background: #000; }
.tf-video video { display: block; width: 100%; max-height: 560px; }
.tf-doc { display: flex; align-items: center; gap: .75rem; padding: .65rem .75rem; border: 1px solid var(--tf-line); border-radius: 12px; background: var(--tf-card); transition: background .15s; }
.tf-doc:hover { background: var(--tf-hover); }
.tf-doc-ico, .tfc-doc-ico, .tfm-file-ico { flex: none; width: 42px; height: 48px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: .66rem; font-weight: 900; letter-spacing: .02em; background: #64748b; box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .12); }
.tf-doc-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.tf-doc-meta b { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-doc-meta small { color: var(--tf-muted); font-size: .75rem; }
.tf-doc-btn { flex: none; padding: .4rem .75rem; border-radius: 8px; background: var(--tf-soft); font-weight: 700; font-size: .8rem; color: var(--tf-text); transition: background .15s; }
.tf-doc-btn:hover { background: var(--tf-line); }
.fk-pdf { background: #e5252a !important; } .fk-word { background: #2b579a !important; } .fk-excel { background: #217346 !important; } .fk-powerpoint { background: #d24726 !important; }
.fk-text { background: #475569 !important; } .fk-archive { background: #b45309 !important; } .fk-image { background: #0d9488 !important; } .fk-video { background: #7c3aed !important; }
.fk-audio { background: #db2777 !important; } .fk-file { background: #64748b !important; }
@media (max-width: 480px) { .tf-doc { flex-wrap: wrap; } .tf-doc-meta { flex-basis: calc(100% - 60px); } .tf-doc-btn { flex: 1; text-align: center; } }

/* ---------- full-screen photo viewer ---------- */
.tfv { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, .95); color: #fff; opacity: 0; transition: opacity .2s, background .2s; touch-action: none; user-select: none; }
.tfv.is-open { opacity: 1; }
.tfv-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: .35rem; padding: .6rem .75rem calc(.6rem); padding-top: max(.6rem, env(safe-area-inset-top));
  background: linear-gradient(rgba(0, 0, 0, .55), transparent); }
.tfv-count { font-weight: 800; font-size: .9rem; padding: 0 .4rem; font-variant-numeric: tabular-nums; }
.tfv-cap { font-size: .9rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tfv-sp { flex: 1; }
.tfv-btn { width: 42px; height: 42px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: rgba(255, 255, 255, .12); transition: background .15s; }
.tfv-btn:hover { background: rgba(255, 255, 255, .24); }
.tfv-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.tfv-img { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; cursor: zoom-in; will-change: transform; transition: opacity .2s; -webkit-user-drag: none; }
.tfv-img.is-loading { opacity: .4; }
.tfv.is-zoomed .tfv-img { cursor: grab; }
.tfv-prev, .tfv-next { position: absolute; top: 50%; transform: translateY(-50%); width: 50px; height: 50px; z-index: 2; }
.tfv-prev { left: 1rem; } .tfv-next { right: 1rem; }
@media (hover: none) and (max-width: 640px) { .tfv-prev, .tfv-next { display: none; } }

/* ---------- PDF viewer ---------- */
.tfdoc { position: fixed; inset: 0; z-index: 120; background: rgba(15, 23, 42, .92); display: flex; flex-direction: column; animation: tf-fade .2s; }
.tfdoc-top { display: flex; align-items: center; gap: .4rem; padding: .6rem .8rem; padding-top: max(.6rem, env(safe-area-inset-top)); color: #fff; }
.tfdoc-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tfdoc-frame { flex: 1; width: min(100%, 1100px); margin: 0 auto .8rem; border: 0; border-radius: 10px; background: #fff; }
@media (max-width: 640px) { .tfdoc-frame { margin: 0; border-radius: 0; } }

/* ---------- live pop-ups ---------- */
.tf-pops { position: fixed; top: 4.25rem; right: .9rem; z-index: 110; width: min(92vw, 23rem); display: flex; flex-direction: column; gap: .55rem; pointer-events: none; }
.tf-pop { pointer-events: auto; position: relative; display: flex; gap: .75rem; align-items: center; padding: .75rem 2.4rem .75rem .75rem; border-radius: 16px; color: var(--tf-text);
  background: color-mix(in srgb, var(--tf-card) 94%, transparent); border: 1px solid var(--tf-line); box-shadow: var(--tf-shadow-lg); backdrop-filter: blur(12px);
  animation: tf-pop-in .38s var(--tf-ease); transition: opacity .3s, transform .3s; text-decoration: none; }
.tf-pop.is-out { opacity: 0; transform: translateX(30px); }
@keyframes tf-pop-in { from { opacity: 0; transform: translateX(40px) scale(.96); } to { opacity: 1; transform: none; } }
.tf-pop:hover { border-color: rgba(24, 119, 242, .4); }
.tf-pop-av { position: relative; flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--tf-grad); color: #fff; font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; justify-content: center; }
.tf-pop-av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.tf-pop-kind { position: absolute; right: -3px; bottom: -3px; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; border: 2px solid var(--tf-card); background: #64748b; }
.tf-pop-message .tf-pop-kind { background: #0084ff; } .tf-pop-connect .tf-pop-kind { background: #16a34a; } .tf-pop-post .tf-pop-kind { background: #f59f0b; } .tf-pop-notify .tf-pop-kind { background: #e11d48; }
.tf-pop-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.tf-pop-text b { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-pop-text span { font-size: .86rem; color: var(--tf-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tf-pop-text small { font-size: .72rem; color: var(--tf-blue); font-weight: 700; margin-top: .1rem; }
.tf-pop-x { position: absolute; top: .45rem; right: .45rem; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--tf-muted); }
.tf-pop-x:hover { background: var(--tf-hover); }
@media (max-width: 640px) { .tf-pops { top: .5rem; top: max(.5rem, env(safe-area-inset-top)); left: .5rem; right: .5rem; width: auto; } @keyframes tf-pop-in { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: none; } } }

/* ---------- "turn on notifications" banner ---------- */
.tf-banner { position: fixed; left: 1rem; bottom: 1rem; z-index: 60; width: min(calc(100vw - 2rem), 26rem); display: flex; flex-wrap: wrap; gap: .75rem; padding: 1rem;
  border-radius: 18px; background: var(--tf-card); color: var(--tf-text); border: 1px solid var(--tf-line); box-shadow: var(--tf-shadow-lg); opacity: 0; transform: translateY(20px); transition: all .35s var(--tf-ease); }
.tf-banner.is-in { opacity: 1; transform: none; }
.tf-banner-ico { flex: none; width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; background: var(--tf-grad); animation: tf-ring 2.6s ease-in-out infinite; }
@keyframes tf-ring { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(14deg); } 80% { transform: rotate(-12deg); } 85% { transform: rotate(8deg); } 90% { transform: rotate(-5deg); } }
.tf-banner-text { flex: 1; min-width: 12rem; display: flex; flex-direction: column; } .tf-banner-text span { font-size: .86rem; color: var(--tf-muted); }
.tf-banner-actions { display: flex; gap: .5rem; margin-left: auto; }
@media (max-width: 1023px) { .tf-banner { left: .6rem; right: .6rem; width: auto; bottom: calc(4.6rem + env(safe-area-inset-bottom)); } }

/* ---------- profile: cover, photo, links ---------- */
.tf-cover { position: relative; height: 13rem; background: var(--tf-grad); overflow: hidden; }
@media (min-width: 640px) { .tf-cover { height: 19rem; } }
.tf-cover-btn { position: absolute; inset: 0; width: 100%; height: 100%; cursor: zoom-in; }
.tf-cover-btn img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--tf-ease), filter .3s; }
.tf-cover-btn:hover img { transform: scale(1.02); filter: brightness(.95); }
.tf-cover-edit { position: absolute; right: .9rem; bottom: .9rem; display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border-radius: 10px; background: rgba(255, 255, 255, .92);
  color: #0f172a; font-weight: 700; font-size: .82rem; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.tf-avatar-wrap { position: relative; flex: none; }
.tf-avatar-big { width: 112px !important; height: 112px !important; box-shadow: 0 0 0 4px var(--tf-card), 0 4px 14px rgba(0, 0, 0, .18); }
@media (min-width: 640px) { .tf-avatar-big { width: 152px !important; height: 152px !important; font-size: 60px !important; } }
.tf-avatar-btn { display: block; border-radius: 50%; cursor: zoom-in; transition: transform .2s var(--tf-ease); }
.tf-avatar-btn:hover { transform: scale(1.02); }
.tf-avatar-edit { position: absolute; right: 4px; bottom: 6px; width: 34px; height: 34px; border-radius: 50%; background: var(--tf-soft); color: var(--tf-text); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 3px var(--tf-card); }
.tf-socials { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.tf-social { display: inline-flex; align-items: center; gap: .45rem; padding: .32rem .8rem .32rem .32rem; border-radius: 999px; border: 1px solid var(--tf-line); background: var(--tf-card);
  font-size: .84rem; font-weight: 700; color: var(--tf-text); transition: transform .15s var(--tf-ease), box-shadow .15s, border-color .15s; }
.tf-social:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 24, 40, .1); border-color: transparent; }
.tf-social-ico { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: #475569; overflow: hidden; }
.tf-social-ico img { width: 18px; height: 18px; object-fit: contain; }
.sl-github .tf-social-ico, .tf-social-ico.sl-github { background: #24292f; } .sl-linkedin .tf-social-ico, .tf-social-ico.sl-linkedin { background: #0a66c2; }
.sl-website .tf-social-ico, .tf-social-ico.sl-website { background: #0ea5e9; } .sl-facebook .tf-social-ico, .tf-social-ico.sl-facebook { background: #1877f2; }
.sl-youtube .tf-social-ico, .tf-social-ico.sl-youtube { background: #e62117; } .sl-twitter .tf-social-ico, .tf-social-ico.sl-twitter { background: #0f1419; }
.sl-instagram .tf-social-ico, .tf-social-ico.sl-instagram { background: linear-gradient(45deg, #f58529, #dd2a7b 55%, #8134af); } .sl-cv .tf-social-ico { background: #16a34a; }
html.dark .sl-github .tf-social-ico, html.dark .sl-twitter .tf-social-ico { background: #3b4658; }
.tf-link-label { display: flex; align-items: center; gap: .4rem; } .tf-link-label .tf-social-ico { width: 22px; height: 22px; }
.tf-cover-preview { margin-top: .5rem; height: 5.5rem; border-radius: 10px; background: var(--tf-grad) center / cover no-repeat; border: 1px solid var(--tf-line); }

/* ---------- settings ---------- */
.tf-push-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem; border-radius: 12px; background: var(--tf-soft); }
.tf-switch { position: relative; display: flex; align-items: center; gap: .75rem; font-size: .9rem; cursor: pointer; }
.tf-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tf-switch span { flex: none; position: relative; width: 44px; height: 26px; border-radius: 999px; background: #cbd5e1; transition: background .2s; }
.tf-switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s var(--tf-ease); }
.tf-switch input:checked + span { background: var(--tf-blue); } .tf-switch input:checked + span::after { transform: translateX(18px); }
.tf-switch input:focus-visible + span { outline: 2px solid var(--tf-blue); outline-offset: 2px; }
html.dark .tf-switch span { background: #334155; }

/* ================= Messenger-style chat ================= */
.tfchat-page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0; }
@media (min-width: 640px) { .tfchat-page { padding: 1rem; } }
.tfchat { display: flex; height: calc(100dvh - 3.5rem - 3.6rem - env(safe-area-inset-bottom)); background: var(--tf-card); color: var(--tf-text); overflow: hidden; }
@media (min-width: 640px) { .tfchat { height: calc(100dvh - 3.5rem - 2rem - 3.6rem); border-radius: 18px; border: 1px solid var(--tf-line); box-shadow: var(--tf-shadow); } }
@media (min-width: 1024px) { .tfchat { height: calc(100dvh - 3.5rem - 2rem); } }
@media (max-width: 767px) {
  .tfchat.has-thread { height: calc(100dvh - 3.5rem); }
  body:has(.tfchat.has-thread) nav[aria-label="Mobile"] { display: none; }
}
.tfchat-side { width: 100%; display: flex; flex-direction: column; border-right: 1px solid var(--tf-line); }
@media (min-width: 768px) { .tfchat-side { width: 340px; flex: none; } }
@media (min-width: 1024px) { .tfchat-side { width: 370px; } }
.tfchat.has-thread .tfchat-side { display: none; }
@media (min-width: 768px) { .tfchat.has-thread .tfchat-side { display: flex; } }
.tfchat-side-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1rem .4rem; }
.tfchat-side-head h1 { font-size: 1.5rem; font-weight: 900; letter-spacing: -.01em; }
.tfchat-search { margin: .25rem .9rem .6rem; display: flex; align-items: center; gap: .5rem; padding: 0 .9rem; border-radius: 999px; background: var(--tf-soft); color: var(--tf-muted); }
.tfchat-search input { flex: 1; background: transparent; border: 0; outline: 0; padding: .6rem 0; color: var(--tf-text); font-size: .92rem; }
.tfchat-list { flex: 1; overflow-y: auto; padding: 0 .45rem .6rem; }
.tfconv { position: relative; display: flex; align-items: center; gap: .75rem; padding: .55rem .6rem; border-radius: 12px; transition: background .12s; }
.tfconv:hover { background: var(--tf-hover); }
.tfconv.is-active { background: rgba(24, 119, 242, .1); }
html.dark .tfconv.is-active { background: rgba(24, 119, 242, .2); }
.tfconv-av { position: relative; flex: none; display: inline-flex; }
.tf-online { position: absolute; right: 1px; bottom: 1px; width: 14px; height: 14px; border-radius: 50%; background: #31a24c; border: 2.5px solid var(--tf-card); }
.tfconv-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.tfconv-main b { font-size: .95rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tfconv-prev { font-size: .82rem; color: var(--tf-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tfconv.is-unread .tfconv-main b, .tfconv.is-unread .tfconv-prev { font-weight: 800; color: var(--tf-text); }
.tfconv-badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--tf-blue); color: #fff; font-style: normal; font-size: .72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.tfchat-section { padding: .9rem .6rem .3rem; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--tf-muted); }
.tfchat-empty-list { padding: 1rem; font-size: .9rem; color: var(--tf-muted); }
.tfchat-iconbtn { flex: none; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--tf-blue); transition: background .12s, transform .1s; }
.tfchat-iconbtn:hover { background: var(--tf-hover); } .tfchat-iconbtn:active { transform: scale(.92); }
.tfchat-main { position: relative; flex: 1; min-width: 0; display: none; flex-direction: column; background: var(--tf-card); }
.tfchat.has-thread .tfchat-main { display: flex; }
@media (min-width: 768px) { .tfchat-main { display: flex; } }
.tfchat-welcome { margin: auto; text-align: center; padding: 2rem; max-width: 24rem; color: var(--tf-muted); }
.tfchat-welcome h2 { font-size: 1.3rem; font-weight: 800; color: var(--tf-text); margin-top: .75rem; }
.tfchat-welcome-ico { display: inline-flex; width: 84px; height: 84px; border-radius: 50%; align-items: center; justify-content: center; color: #fff; background: var(--tf-grad); box-shadow: 0 10px 30px rgba(24, 119, 242, .35); }
.tfchat-head { display: flex; align-items: center; gap: .25rem; padding: .5rem .6rem; border-bottom: 1px solid var(--tf-line); box-shadow: 0 2px 6px rgba(16, 24, 40, .03); z-index: 2; }
.tfchat-back { margin-right: -.2rem; }
@media (min-width: 768px) { .tfchat-back { display: none; } }
.tfchat-who { display: flex; align-items: center; gap: .65rem; min-width: 0; flex: 1; padding: .2rem .4rem; border-radius: 10px; }
.tfchat-who:hover { background: var(--tf-hover); }
.tfchat-who b { display: block; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tfchat-who small { display: block; font-size: .76rem; color: var(--tf-muted); }
.tfchat-msgs { flex: 1; overflow-y: auto; padding: 1rem .9rem .5rem; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; }
.tfchat-intro { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1rem 0 1.4rem; text-align: center; }
.tfchat-intro b { font-size: 1.1rem; } .tfchat-intro small { color: var(--tf-muted); }
.tfm-day { align-self: center; margin: .9rem 0 .5rem; font-size: .72rem; font-weight: 700; color: var(--tf-muted); }
.tfm-row { display: flex; align-items: flex-end; gap: .45rem; max-width: 100%; margin-top: .55rem; animation: tf-msg-in .22s var(--tf-ease); }
@keyframes tf-msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tfm-row.is-cont { margin-top: 2px; }
.tfm-row.me { flex-direction: row-reverse; }
.tfm-row.is-pending { opacity: .6; }
.tfm-av { flex: none; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; background: var(--tf-grad); color: #fff; font-size: .75rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.tfm-av img { width: 100%; height: 100%; object-fit: cover; }
.tfm-row.them.has-next > .tfm-av { visibility: hidden; }
.tfm-col { display: flex; flex-direction: column; max-width: min(75%, 34rem); min-width: 0; }
.tfm-row.me .tfm-col { align-items: flex-end; }
.tfm-bubble { padding: .5rem .8rem; border-radius: 20px; font-size: .94rem; line-height: 1.4; word-wrap: break-word; overflow-wrap: anywhere; background: var(--tf-them); color: var(--tf-text); }
.tfm-row.me .tfm-bubble { background: var(--tf-me); color: #fff; }
.tfm-row.me .tfm-bubble a { color: #fff; text-decoration: underline; }
.tfm-row.me.has-next .tfm-bubble { border-bottom-right-radius: 6px; } .tfm-row.me.is-cont .tfm-bubble { border-top-right-radius: 6px; }
.tfm-row.them.has-next .tfm-bubble { border-bottom-left-radius: 6px; } .tfm-row.them.is-cont .tfm-bubble { border-top-left-radius: 6px; }
.tfm-bubble.is-emoji { background: none !important; padding: 0; font-size: 2.6rem; line-height: 1.15; }
.tfm-bubble .tf-code { font-size: .8rem; margin: .25rem 0; max-width: 100%; overflow-x: auto; }
.tfm-media + .tfm-bubble { margin-top: 3px; }
.tfm-meta { font-size: .66rem; color: var(--tf-muted); margin-top: 2px; padding: 0 .35rem; display: flex; gap: .3rem; align-items: center; }
.tfm-row.has-next .tfm-meta { display: none; }
.tfm-tick { color: var(--tf-blue); font-weight: 800; display: inline-flex; }
.tfm-seen { align-self: flex-end; margin: 0 2px 2px 0; }
.tfm-seen .tfm-av { width: 15px; height: 15px; font-size: .5rem; }
.tfm-img { display: block; border-radius: 18px; overflow: hidden; cursor: zoom-in; background: var(--tf-soft); }
.tfm-img img { display: block; max-width: min(17rem, 62vw); max-height: 22rem; object-fit: cover; }
.tfm-video { display: block; max-width: min(19rem, 66vw); max-height: 24rem; border-radius: 18px; background: #000; }
.tfm-audio { padding: .35rem; border-radius: 22px; background: var(--tf-them); }
.tfm-row.me .tfm-audio { background: var(--tf-me); }
.tfm-audio audio { display: block; width: min(16rem, 62vw); height: 40px; }
.tfm-file { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 16px; background: var(--tf-them); color: var(--tf-text); text-align: left; max-width: 19rem; min-width: 13rem; transition: filter .15s; }
.tfm-file:hover { filter: brightness(.97); }
.tfm-row.me .tfm-file { background: color-mix(in srgb, var(--tf-blue) 14%, var(--tf-card)); }
.tfm-file .tfm-file-ico { width: 38px; height: 44px; }
.tfm-file-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.tfm-file-meta b { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tfm-file-meta small { font-size: .72rem; color: var(--tf-muted); }
.tfm-file-dl { flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, .07); color: var(--tf-text); }
.tfchat-typing { padding: .1rem 1rem .4rem 3rem; }
.tf-dots { display: inline-flex; gap: 4px; padding: .7rem .9rem; border-radius: 20px; background: var(--tf-them); }
.tf-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--tf-muted); animation: tf-bounce 1.2s infinite ease-in-out; }
.tf-dots i:nth-child(2) { animation-delay: .15s; } .tf-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tf-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* composer */
.tfchat-compose { display: flex; align-items: flex-end; gap: .3rem; padding: .55rem .6rem; padding-bottom: max(.55rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--tf-line); background: var(--tf-card); }
.tfchat-attach { position: relative; }
.tfchat-plus { color: #fff; background: var(--tf-blue); width: 36px; height: 36px; margin: 0 .15rem .15rem 0; }
.tfchat-plus:hover { background: var(--tf-blue-d); }
.tfchat-attach-menu { position: absolute; left: 0; bottom: calc(100% + .5rem); z-index: 5; width: 17rem; padding: .4rem; border-radius: 14px; background: var(--tf-card); border: 1px solid var(--tf-line); box-shadow: var(--tf-shadow-lg); animation: tf-slide-in .18s var(--tf-ease); }
.tfchat-attach-menu button { width: 100%; display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem; border-radius: 10px; font-weight: 600; font-size: .9rem; text-align: left; }
.tfchat-attach-menu button:hover { background: var(--tf-hover); }
.am-ico { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.am-media { background: #45bd62; } .am-doc { background: #f59f0b; } .am-any { background: #8b5cf6; }
.tfchat-field { flex: 1; min-width: 0; display: flex; align-items: flex-end; border-radius: 22px; background: var(--tf-soft); padding-left: .9rem; }
.tfchat-field textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: transparent; color: var(--tf-text); font-size: .95rem; line-height: 1.35; padding: .55rem 0; max-height: 140px; }
.tfchat-field .tfchat-iconbtn { width: 36px; height: 36px; }
.tfchat-send { flex: none; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--tf-grad); box-shadow: 0 3px 10px rgba(24, 119, 242, .35); transition: transform .12s; }
.tfchat-send:active { transform: scale(.9); } .tfchat-send:disabled { opacity: .5; }
.tfchat-emoji { display: grid; grid-template-columns: repeat(10, 1fr); gap: .1rem; margin: 0 .6rem .4rem; padding: .45rem; border-radius: 14px; border: 1px solid var(--tf-line); background: var(--tf-card); box-shadow: var(--tf-shadow); }
@media (max-width: 480px) { .tfchat-emoji { grid-template-columns: repeat(8, 1fr); } }
.tfchat-tray { display: flex; gap: .5rem; overflow-x: auto; padding: .6rem .7rem .2rem; border-top: 1px solid var(--tf-line); }
.tft-item { position: relative; flex: none; width: 72px; height: 72px; border-radius: 12px; overflow: hidden; background: var(--tf-soft); animation: tf-fade .2s; }
.tft-item img, .tft-item video { width: 100%; height: 100%; object-fit: cover; }
.tft-item.is-file { width: 13rem; display: flex; align-items: center; gap: .5rem; padding: 0 2rem 0 .5rem; }
.tft-item.is-file .tfm-file-ico { width: 34px; height: 40px; }
.tft-meta { min-width: 0; display: flex; flex-direction: column; } .tft-meta b { font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .tft-meta small { font-size: .7rem; color: var(--tf-muted); }
.tft-rm { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .92); color: #111; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.tft-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, .15); display: none; }
.tft-prog i { display: block; height: 100%; width: 0; background: var(--tf-grad); transition: width .15s; }
.tfchat-tray.is-sending .tft-prog { display: block; }
.tfchat-rec { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; padding-bottom: max(.55rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--tf-line); font-weight: 700; font-variant-numeric: tabular-nums; }
.tfchat-rec .tfchat-iconbtn { color: #dc2626; }
.tfchat-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #dc2626; animation: tf-pulse 1s infinite; }
@keyframes tf-pulse { 50% { opacity: .25; } }
.tfchat-rec-wave { flex: 1; height: 26px; border-radius: 13px; background: repeating-linear-gradient(90deg, var(--tf-blue) 0 3px, transparent 3px 7px); opacity: .5; animation: tf-wave 1.1s linear infinite; mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); }
@keyframes tf-wave { to { background-position: 28px 0; } }
.tfchat-drop { position: absolute; inset: .5rem; z-index: 6; border: 2px dashed var(--tf-blue); border-radius: 16px; background: color-mix(in srgb, var(--tf-card) 88%, var(--tf-blue)); color: var(--tf-blue);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; font-weight: 800; pointer-events: none; }
.tfchat-locked { padding: 1rem; text-align: center; font-size: .9rem; color: var(--tf-muted); border-top: 1px solid var(--tf-line); }
html.dark .tfm-file-dl { background: rgba(255, 255, 255, .08); }
