/* TechFace.NET v4 shared UI kit (loaded after ui.css on every page).
   app.css is a pre-compiled Tailwind build: utility classes that are not already in it do NOT exist.
   New pages use these hand-written components + the CSS variables from ui.css. Light + dark. Mobile first. */

/* ---------- layout ---------- */
.tf4-page { width: 100%; max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.tf4-page-narrow { max-width: 760px; }
.tf4-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.tf4-head h1 { font-size: 1.5rem; font-weight: 900; letter-spacing: -.01em; }
.tf4-sub { color: var(--tf-muted); font-size: .9rem; }
.tf4-grid { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .tf4-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .tf4-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tf4-grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .tf4-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tf4-split { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .tf4-split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.tf4-row { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.tf4-row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.tf4-stack { display: flex; flex-direction: column; gap: .6rem; }
.tf4-grow { flex: 1; min-width: 0; }
.tf4-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf4-muted { color: var(--tf-muted); }
.tf4-small { font-size: .82rem; }
.tf4-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.tf4-num { font-variant-numeric: tabular-nums; }

/* ---------- surfaces ---------- */
.tf4-card { background: var(--tf-card); color: var(--tf-text); border: 1px solid var(--tf-line); border-radius: 16px; box-shadow: var(--tf-shadow); padding: 1rem; }
.tf4-card-flush { padding: 0; overflow: hidden; }
.tf4-card h2, .tf4-h2 { font-size: 1.05rem; font-weight: 800; margin-bottom: .6rem; }
.tf4-section-title { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--tf-muted); }

/* stat tile */
.tf4-stat { background: var(--tf-card); border: 1px solid var(--tf-line); border-radius: 14px; padding: .8rem .9rem; box-shadow: var(--tf-shadow); min-width: 0; }
.tf4-stat-label { font-size: .75rem; font-weight: 700; color: var(--tf-muted); display: flex; align-items: center; gap: .35rem; }
.tf4-stat-value { font-size: 1.55rem; font-weight: 900; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: .15rem; }
.tf4-stat-note { font-size: .74rem; color: var(--tf-muted); margin-top: .1rem; }
.tf4-up { color: #16a34a; } .tf4-down { color: #dc2626; }

/* ---------- buttons ---------- */
.tf4-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .5rem 1rem; border-radius: 10px;
  font-weight: 700; font-size: .9rem; border: 1px solid transparent; cursor: pointer; transition: transform .1s var(--tf-ease), background .15s, box-shadow .15s; user-select: none; }
.tf4-btn:active:not(:disabled) { transform: scale(.97); }
.tf4-btn:disabled { opacity: .55; cursor: not-allowed; }
.tf4-btn-primary { background: var(--tf-blue); color: #fff; box-shadow: 0 2px 8px rgba(24, 119, 242, .3); }
.tf4-btn-primary:hover:not(:disabled) { background: var(--tf-blue-d); }
.tf4-btn-grad { background: var(--tf-grad); color: #fff; box-shadow: 0 4px 14px rgba(24, 119, 242, .35); }
.tf4-btn-ghost { background: var(--tf-soft); color: var(--tf-text); }
.tf4-btn-ghost:hover:not(:disabled) { background: var(--tf-hover); filter: brightness(.97); }
.tf4-btn-outline { background: transparent; color: var(--tf-text); border-color: var(--tf-line); }
.tf4-btn-danger { background: #dc2626; color: #fff; }
.tf4-btn-success { background: #16a34a; color: #fff; }
.tf4-btn-sm { min-height: 32px; padding: .3rem .7rem; font-size: .8rem; border-radius: 8px; }
.tf4-btn-block { width: 100%; }
.tf4-icon-btn { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--tf-text); transition: background .12s; }
.tf4-icon-btn:hover { background: var(--tf-hover); }

/* ---------- form ---------- */
.tf4-field { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; }
.tf4-input, .tf4-select, .tf4-textarea { width: 100%; border: 1px solid var(--tf-line); background: var(--tf-card); color: var(--tf-text); border-radius: 10px;
  padding: .6rem .75rem; font-size: .95rem; font-weight: 400; outline: none; transition: border-color .15s, box-shadow .15s; }
.tf4-input:focus, .tf4-select:focus, .tf4-textarea:focus { border-color: var(--tf-blue); box-shadow: 0 0 0 3px rgba(24, 119, 242, .18); }
.tf4-hint { font-size: .76rem; color: var(--tf-muted); font-weight: 400; }
.tf4-check { display: flex; align-items: flex-start; gap: .55rem; font-size: .9rem; cursor: pointer; }
.tf4-check input { margin-top: .2rem; width: 1.05rem; height: 1.05rem; accent-color: var(--tf-blue); }
/* toggle switch: <label class="tf4-switch"><input type="checkbox"><span></span> Text</label> */
.tf4-switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-weight: 600; }
.tf4-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tf4-switch span { position: relative; width: 44px; height: 26px; border-radius: 999px; background: #cbd5e1; transition: background .2s; flex: none; }
.tf4-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); }
.tf4-switch input:checked + span { background: var(--tf-blue); }
.tf4-switch input:checked + span::after { transform: translateX(18px); }
.tf4-switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(24, 119, 242, .35); }

/* ---------- chips, badges, tabs ---------- */
.tf4-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .7rem; border-radius: 999px; background: var(--tf-soft); color: var(--tf-text);
  font-size: .8rem; font-weight: 700; border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.tf4-chip.is-active, .tf4-chip[aria-pressed="true"], .tf4-chip[aria-selected="true"] { background: rgba(24, 119, 242, .12); color: var(--tf-blue); border-color: rgba(24, 119, 242, .35); }
.tf4-badge { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 800; line-height: 1.4; white-space: nowrap; }
.tf4-badge-gray { background: var(--tf-soft); color: var(--tf-muted); }
.tf4-badge-blue { background: rgba(24, 119, 242, .12); color: #1d6ae5; }
.tf4-badge-green { background: rgba(22, 163, 74, .13); color: #15803d; }
.tf4-badge-amber { background: rgba(245, 158, 11, .16); color: #b45309; }
.tf4-badge-red { background: rgba(220, 38, 38, .12); color: #b91c1c; }
.tf4-badge-violet { background: rgba(124, 58, 237, .13); color: #6d28d9; }
html.dark .tf4-badge-blue { color: #7cb3ff; } html.dark .tf4-badge-green { color: #4ade80; } html.dark .tf4-badge-amber { color: #fbbf24; }
html.dark .tf4-badge-red { color: #f87171; } html.dark .tf4-badge-violet { color: #c4b5fd; }
.tf4-tabs { display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tf4-tabs::-webkit-scrollbar { display: none; }
.tf4-count { display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 10px; font-weight: 800; align-items: center; justify-content: center; }

/* ---------- tables / lists ---------- */
.tf4-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tf4-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tf4-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--tf-muted); font-weight: 800; padding: .5rem .6rem; border-bottom: 1px solid var(--tf-line); white-space: nowrap; }
.tf4-table td { padding: .55rem .6rem; border-bottom: 1px solid var(--tf-line); vertical-align: middle; }
.tf4-table tr:last-child td { border-bottom: 0; }
.tf4-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.tf4-list { display: flex; flex-direction: column; }
.tf4-list-item { display: flex; align-items: center; gap: .7rem; padding: .65rem .75rem; border-bottom: 1px solid var(--tf-line); min-width: 0; }
.tf4-list-item:last-child { border-bottom: 0; }
a.tf4-list-item:hover, button.tf4-list-item:hover { background: var(--tf-hover); }
.tf4-empty { text-align: center; padding: 2rem 1rem; color: var(--tf-muted); }
.tf4-empty b { display: block; color: var(--tf-text); font-size: 1.05rem; margin-bottom: .25rem; }

/* ---------- alerts ---------- */
.tf4-alert { border-radius: 12px; padding: .7rem .9rem; font-size: .9rem; border: 1px solid; }
.tf4-alert-ok { background: rgba(22, 163, 74, .08); border-color: rgba(22, 163, 74, .35); color: #166534; }
.tf4-alert-err { background: rgba(220, 38, 38, .08); border-color: rgba(220, 38, 38, .35); color: #991b1b; }
.tf4-alert-warn { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .4); color: #92400e; }
.tf4-alert-info { background: rgba(24, 119, 242, .07); border-color: rgba(24, 119, 242, .3); color: #1e40af; }
html.dark .tf4-alert-ok { color: #86efac; } html.dark .tf4-alert-err { color: #fca5a5; } html.dark .tf4-alert-warn { color: #fcd34d; } html.dark .tf4-alert-info { color: #93c5fd; }

/* ---------- modal + bottom sheet (mobile) ----------
   <div class="tf4-modal" hidden><div class="tf4-modal-box" role="dialog" aria-modal="true">…</div></div> */
.tf4-modal { position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 42, .55); display: flex; align-items: flex-end; justify-content: center; animation: tf-fade .15s; }
@media (min-width: 640px) { .tf4-modal { align-items: center; padding: 1rem; } }
.tf4-modal-box { width: 100%; max-width: 30rem; max-height: 88dvh; display: flex; flex-direction: column; background: var(--tf-card); color: var(--tf-text);
  border-radius: 18px 18px 0 0; box-shadow: var(--tf-shadow-lg); padding-bottom: env(safe-area-inset-bottom); animation: tf4-up .22s var(--tf-ease); }
@media (min-width: 640px) { .tf4-modal-box { border-radius: 18px; } }
.tf4-modal-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .85rem 1rem; border-bottom: 1px solid var(--tf-line); font-weight: 800; }
.tf4-modal-body { padding: 1rem; overflow-y: auto; }
.tf4-modal-foot { padding: .75rem 1rem; border-top: 1px solid var(--tf-line); display: flex; gap: .5rem; justify-content: flex-end; }
@keyframes tf4-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
/* action sheet (long-press menus) */
.tf4-sheet-actions { display: flex; flex-direction: column; padding: .35rem; }
.tf4-sheet-actions button, .tf4-sheet-actions a { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .75rem .8rem; border-radius: 10px; font-weight: 600; text-align: left; }
.tf4-sheet-actions button:hover, .tf4-sheet-actions a:hover { background: var(--tf-hover); }
.tf4-sheet-actions .is-danger { color: #dc2626; }

/* ---------- avatars ---------- */
.tf4-avatar { position: relative; flex: none; display: inline-block; }
.tf4-online-dot { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid var(--tf-card); }

/* ---------- simple bar / spark charts (pure CSS + SVG) ---------- */
.tf4-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.tf4-bars > span { flex: 1; min-width: 3px; background: var(--tf-blue); border-radius: 4px 4px 0 0; opacity: .85; }
.tf4-meter { height: 8px; border-radius: 999px; background: var(--tf-soft); overflow: hidden; }
.tf4-meter > span { display: block; height: 100%; background: var(--tf-grad); border-radius: 999px; }

/* ---------- skeleton ---------- */
.tf4-skel { background: linear-gradient(90deg, var(--tf-soft) 25%, var(--tf-hover) 50%, var(--tf-soft) 75%); background-size: 200% 100%; animation: tf4-shimmer 1.2s infinite; border-radius: 8px; }
@keyframes tf4-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- header extras (v4 nav) ---------- */
.tf4-hicon { position: relative; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--tf-soft); color: var(--tf-text); flex: none; }
.tf4-hicon:hover { background: var(--tf-hover); }
.tf4-hicon.is-active { color: var(--tf-blue); background: rgba(24, 119, 242, .12); }
.tf4-hicon .badge-dot { top: -3px; right: -4px; }
.tf4-mobile-only { display: inline-flex; }
@media (min-width: 1024px) { .tf4-mobile-only { display: none !important; } }
.tf4-fab { position: fixed; right: 1rem; bottom: calc(4.6rem + env(safe-area-inset-bottom)); z-index: 39; width: 56px; height: 56px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--tf-grad); box-shadow: 0 8px 24px rgba(24, 119, 242, .45); }
@media (min-width: 1024px) { .tf4-fab { display: none; } }
.tf-tab-grid6 { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }

/* small helpers missing from the compiled Tailwind build */
.tf4-mt { margin-top: 1rem; } .tf4-mb { margin-bottom: 1rem; }
.tf4-ok-text { color: #16a34a; } .tf4-err-text { color: #dc2626; } .tf4-warn-text { color: #d97706; }
.tf4-ol { list-style: decimal; padding-left: 1.25rem; }
.tf4-ul { list-style: disc; padding-left: 1.25rem; }
.tf4-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
