.tb-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.seg { display: inline-flex; flex-wrap: nowrap; max-width: 100%; overflow-x: auto; gap: 4px; background: var(--navy-deep); border: 1px solid var(--navy-line); border-radius: 999px; padding: 4px; }
.seg button { flex-shrink: 0; background: none; border: 0; color: var(--silver-soft); border-radius: 999px; padding: 0 14px; min-height: 36px; cursor: pointer; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--maroon); color: var(--white); }
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 20px; scrollbar-width: thin; }
.cat { flex-shrink: 0; background: var(--navy-deep); border: 1px solid var(--navy-line); color: var(--silver-soft); border-radius: 999px; padding: 0 14px; min-height: 38px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.cat span { color: var(--silver); font-variant-numeric: tabular-nums; margin-left: 4px; }
.cat[aria-pressed="true"] { border-color: var(--silver); color: var(--white); background: var(--navy-line); }

.tb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tb-card { position: relative; background: var(--navy-deep); border: 1px solid var(--navy-line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.pinned { position: absolute; top: 10px; left: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 4px; background: var(--maroon); color: var(--white); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; }
.tb-thumb { aspect-ratio: 16 / 9; max-width: 100%; display: flex; align-items: center; justify-content: center; background: var(--navy-line); color: var(--silver-soft); position: relative; }
.tb-thumb.t-doc { background: #2A3550; }
.tb-thumb.t-video { background: #3A2430; }
.tb-thumb.t-audio { background: #263A3A; }
.tb-thumb.t-link { background: #2E3346; }
.tb-thumb.yt img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.play { position: absolute; width: 56px; height: 40px; border-radius: 10px; background: rgba(0, 0, 0, 0.7); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.tb-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.tb-cat { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--silver); }
.tb-body h3 { margin: 0; font-size: 19px; text-transform: none; letter-spacing: 0.3px; line-height: 1.2; }
.tb-desc { margin: 0; font-size: 14px; line-height: 1.55; color: #D9DBE0; overflow-wrap: anywhere; }
.tb-meta { margin: 0; font-size: 12px; color: var(--silver); overflow-wrap: anywhere; }
.tb-actions { margin-top: auto; padding-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tb-open { min-height: 40px; min-width: 0; padding: 0 16px; font-size: 14px; letter-spacing: 2px; }
.cbtn.danger { color: #F2A7A8; }

.tb-modal.public { min-height: 0; background: rgba(5, 9, 18, 0.88); }
.tb-modal { position: fixed; inset: 0; z-index: 40; background: rgba(5, 9, 18, 0.88); display: flex; align-items: center; justify-content: center; overflow-y: auto;
  padding: max(20px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(20px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.tb-modal-box { width: min(880px, 100%); background: var(--navy); border: 1px solid var(--navy-line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 14px; margin: auto; }
.tb-form { width: min(560px, 100%); }
.tb-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tb-modal-head h3 { margin: 0; font-size: 22px; text-transform: uppercase; letter-spacing: 1px; }
.tb-frame { position: relative; aspect-ratio: 16 / 9; max-width: 100%; background: #000; border-radius: 8px; overflow: hidden; }
.tb-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tb-video { width: 100%; max-height: 70vh; background: #000; border-radius: 8px; }
.tb-img { max-width: 100%; max-height: 72vh; border-radius: 8px; align-self: center; }
.tb-audio { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 28px 12px; color: var(--silver-soft); }
.tb-audio audio { width: 100%; }
.tb-form .seg { align-self: flex-start; border-radius: 12px; }
.tb-form .seg button { border-radius: 8px; }
.tb-form .field { margin: 0; }
.tb-form input[type=file] { color: var(--silver-soft); width: 100%; padding: 12px; border: 1px dashed var(--silver); border-radius: 6px; background: var(--navy-deep); }
.tb-progress { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--silver-soft); font-variant-numeric: tabular-nums; }
.tb-progress .bar { flex: 1; height: 8px; background: var(--navy-line); border-radius: 999px; overflow: hidden; }
.tb-progress .bar span { display: block; height: 100%; width: 0; background: var(--maroon-bright); transition: width 0.2s; }
@media (prefers-reduced-motion: reduce) { .tb-progress .bar span { transition: none; } }
@media (max-width: 480px) { .tb-grid { grid-template-columns: minmax(0, 1fr); } }
