/* TikTok Hub — glass dark (#0a0a0f), Inter + JetBrains Mono */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

#page-tiktok {
  -webkit-font-smoothing: antialiased;
  background: #0a0a0f;
}

#page-tiktok .tt-hub-hidden {
  display: none !important;
}

.tt-hub {
  --tt-accent: #00c9a7;
  --tt-accent-dim: rgba(0, 201, 167, 0.15);
  --tt-surface: rgba(255, 255, 255, 0.05);
  --tt-border: rgba(255, 255, 255, 0.1);
  --tt-text: rgba(255, 255, 255, 0.92);
  --tt-muted: rgba(255, 255, 255, 0.52);
  --tt-radius: 14px;
  --tt-radius-sm: 10px;
  color: var(--tt-text);
  font-family: 'Inter', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

.tt-hub .tt-mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.tt-post-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 4px;
  vertical-align: middle;
}

.tt-post-badge.will-post {
  background: rgba(0, 201, 167, 0.2);
  color: #00e6be;
  border: 1px solid rgba(0, 201, 167, 0.45);
}

.tt-post-badge.preview {
  background: rgba(255, 255, 255, 0.06);
  color: var(--tt-muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.tt-post-badge.old {
  background: rgba(255, 120, 80, 0.12);
  color: rgba(255, 180, 140, 0.9);
  border: 1px solid rgba(255, 120, 80, 0.25);
}

.tt-legacy-warn {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 90, 60, 0.15);
  border: 1px solid rgba(255, 120, 80, 0.45);
  color: #ffc9b0;
  font-size: 12px;
  line-height: 1.4;
}

.tt-post-badge.posted {
  background: rgba(100, 140, 255, 0.15);
  color: #9eb8ff;
  border: 1px solid rgba(100, 140, 255, 0.3);
}

.tt-thumb-ready,
.tt-mini-ready {
  color: var(--tt-accent);
  border-color: rgba(0, 201, 167, 0.35);
}

.tt-glass {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--tt-radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.tt-hub-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border-radius: var(--tt-radius);
  border: 1px solid rgba(0, 201, 167, 0.35);
  background: linear-gradient(135deg, rgba(10, 10, 15, 0.95) 0%, rgba(15, 26, 34, 0.9) 45%, rgba(20, 16, 42, 0.9) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 12px 40px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}

.tt-hub-header::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -5%;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 201, 167, 0.12), transparent 70%);
  pointer-events: none;
}

.tt-hub-brand {
  flex: 1;
  min-width: 200px;
  position: relative;
  z-index: 1;
}

.tt-hub-brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-wrap: balance;
}

.tt-hub-brand h1 span {
  color: var(--tt-accent);
}

.tt-hub-sub {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--tt-muted);
}

.tt-hub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.tt-hub-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border-radius: var(--tt-radius-sm);
  border: 1px solid var(--tt-border);
  background: var(--tt-surface);
  color: var(--tt-text);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.2, 0, 0, 1), background 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.tt-hub-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.tt-hub-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.tt-hub-btn.primary {
  background: linear-gradient(135deg, rgba(0, 201, 167, 0.25), rgba(0, 150, 136, 0.15));
  border-color: rgba(0, 201, 167, 0.45);
  color: #5dffd9;
}

.tt-hub-btn.danger {
  border-color: rgba(255, 68, 68, 0.35);
  color: #ff8a8a;
}

.tt-hub-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.tt-hub-btn.is-busy {
  position: relative;
  color: transparent !important;
}

.tt-hub-btn.is-busy::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--tt-accent);
  border-radius: 50%;
  animation: tt-spin 0.65s linear infinite;
}

@keyframes tt-spin {
  to {
    transform: rotate(360deg);
  }
}

.tt-hub-accounts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tt-acc-chip {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--tt-border);
  background: var(--tt-surface);
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, color 0.15s;
}

.tt-acc-chip:hover {
  color: var(--tt-text);
}

.tt-acc-chip.active {
  border-color: rgba(0, 201, 167, 0.55);
  background: var(--tt-accent-dim);
  color: #7dffe8;
}

.tt-acc-chip.placeholder {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.tt-hub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tt-tab {
  min-height: 44px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--tt-radius-sm) var(--tt-radius-sm) 0 0;
  background: transparent;
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.tt-tab:hover {
  color: var(--tt-text);
}

.tt-tab.active {
  color: var(--tt-accent);
  background: rgba(0, 201, 167, 0.08);
  box-shadow: 0 -2px 0 var(--tt-accent) inset;
}

.tt-panel {
  display: none;
  animation: ttHubIn 0.35s cubic-bezier(0.2, 0, 0, 1) both;
}

.tt-panel.active {
  display: block;
}

@keyframes ttHubIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Split pane: queue + preview */
.tt-split-pane {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 14px;
  align-items: stretch;
  min-height: min(72vh, 720px);
}

@media (max-width: 960px) {
  .tt-split-pane {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .tt-split-right {
    order: -1;
  }
}

.tt-split-left {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tt-queue-scroll {
  flex: 1;
  overflow-y: auto;
  max-height: min(72vh, 680px);
  padding-right: 4px;
}

.tt-queue-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: var(--tt-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.tt-queue-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.tt-queue-item.selected {
  border-color: rgba(0, 201, 167, 0.45);
  background: rgba(0, 201, 167, 0.08);
}

.tt-queue-item .tt-mini-thumb {
  width: 44px;
  height: 78px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.4);
  outline: 1px solid rgba(255, 255, 255, 0.1);
}

.tt-queue-item .tt-mini-ph {
  width: 44px;
  height: 78px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--tt-muted);
}

.tt-split-right {
  display: flex;
  flex-direction: column;
}

.tt-preview-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
}

.tt-preview-video-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: var(--tt-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tt-preview-video {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 9 / 16;
  max-height: min(62vh, 520px);
  border-radius: 10px;
  object-fit: contain;
  background: #000;
  outline: 1px solid rgba(255, 255, 255, 0.12);
}

.tt-preview-placeholder {
  color: var(--tt-muted);
  font-size: 12px;
  text-align: center;
  padding: 24px;
}

.tt-preview-meta {
  font-size: 11px;
  color: var(--tt-muted);
  line-height: 1.45;
}

.tt-preview-meta strong {
  color: var(--tt-text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
}

.tt-preview-actions .tt-row-actions {
  margin-top: 4px;
}

.tt-admin-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
}

.tt-admin-bar select {
  flex: 1;
  min-width: 140px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--tt-radius-sm);
  border: 1px solid var(--tt-border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--tt-text);
  font-family: inherit;
  font-size: 12px;
}

.tt-admin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--tt-radius-sm);
  border: 1px solid var(--tt-border);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  user-select: none;
}

.tt-admin-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--tt-accent);
}

.tt-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.tt-kpi {
  padding: 14px 12px;
  border-radius: var(--tt-radius-sm);
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  text-align: center;
  backdrop-filter: blur(8px);
}

.tt-kpi .val {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
}

.tt-kpi .lbl {
  margin-top: 4px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tt-muted);
}

.tt-kpi.accent .val {
  color: var(--tt-accent);
}

.tt-kpi.warn .val {
  color: #ffc107;
}

.tt-kpi.err .val {
  color: #ff6b8a;
}

.tt-card {
  border-radius: var(--tt-radius);
  border: 1px solid var(--tt-border);
  background: var(--tt-surface);
  backdrop-filter: blur(12px);
  padding: 16px;
  margin-bottom: 14px;
}

.tt-card-title {
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 12px;
  color: var(--tt-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tt-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tt-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--tt-border);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.tt-pill.ok {
  background: rgba(0, 230, 118, 0.12);
  border-color: rgba(0, 230, 118, 0.35);
  color: #00e676;
}

.tt-pill.warn {
  background: rgba(255, 193, 7, 0.12);
  border-color: rgba(255, 193, 7, 0.4);
  color: #ffc107;
}

.tt-pill.err {
  background: rgba(255, 68, 68, 0.12);
  border-color: rgba(255, 68, 68, 0.35);
  color: #ff6b8a;
}

.tt-table-wrap {
  overflow-x: auto;
  border-radius: var(--tt-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.tt-table th {
  padding: 10px 8px;
  text-align: left;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tt-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tt-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.tt-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.tt-table tr.tt-row-selected td {
  background: rgba(0, 201, 167, 0.06);
}

.tt-thumb {
  width: 44px;
  height: 78px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.4);
}

.tt-thumb-placeholder {
  width: 44px;
  height: 78px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.tt-hook {
  max-width: 220px;
  line-height: 1.35;
  color: var(--tt-muted);
}

.tt-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.tt-status-badge.pending {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
}

.tt-status-badge.approved {
  background: rgba(0, 230, 118, 0.15);
  color: #00e676;
}

.tt-status-badge.posted {
  background: rgba(255, 255, 255, 0.08);
  color: var(--tt-muted);
}

.tt-status-badge.rejected {
  background: rgba(255, 68, 68, 0.15);
  color: #ff6b8a;
}

.tt-render {
  font-size: 10px;
  font-weight: 600;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.tt-render.rendering {
  color: #00d4ff;
}

.tt-render.ready {
  color: #00e676;
}

.tt-render.missing {
  color: var(--tt-muted);
}

.tt-render.error {
  color: #ff6b8a;
}

.tt-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tt-row-actions .tt-hub-btn {
  min-height: 36px;
  padding: 0 10px;
  font-size: 10px;
}

.tt-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--tt-muted);
  font-size: 12px;
}

.tt-error-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 480px;
  overflow-y: auto;
}

.tt-error-item {
  padding: 12px;
  border-radius: var(--tt-radius-sm);
  background: rgba(255, 68, 68, 0.06);
  border: 1px solid rgba(255, 68, 68, 0.2);
  font-size: 11px;
}

.tt-error-item .meta {
  font-size: 9px;
  color: var(--tt-muted);
  margin-bottom: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.tt-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 768px) {
  .tt-settings-grid {
    grid-template-columns: 1fr;
  }
}

.tt-field {
  margin-bottom: 10px;
}

.tt-field label {
  display: block;
  font-size: 10px;
  color: var(--tt-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.tt-field input,
.tt-field select,
.tt-field textarea {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: var(--tt-radius-sm);
  border: 1px solid var(--tt-border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--tt-text);
  font-size: 12px;
  font-family: inherit;
}

.tt-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding-top: 8px;
}

.tt-bar {
  flex: 1;
  min-width: 28px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--tt-accent), rgba(0, 201, 167, 0.35));
  position: relative;
}

.tt-bar span {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  color: var(--tt-muted);
}
