:root {
  --bg-main: #0a0d14;
  --bg-card: #121722;
  --bg-card-hover: #182030;
  --bg-input: #1a2234;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.4);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.12);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-phone: 36px;
  
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
  
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-phone: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 0 12px #1e2538;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
}

/* App Layout */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1720px;
  margin: 0 auto;
  padding: 16px 24px;
  gap: 16px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-avatar-ring {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, var(--accent-primary), var(--color-success));
}

.brand-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.online-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background-color: var(--color-success);
  border: 2px solid var(--bg-card);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-success);
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ai-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 2px 8px;
  border-radius: 20px;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stats-pills {
  display: flex;
  gap: 8px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 0.82rem;
}

.stat-label {
  color: var(--text-secondary);
}

.stat-value {
  font-weight: 700;
}

.pending-color { color: var(--color-warning); }
.approved-color { color: var(--color-success); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-main);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #4338ca);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-warning {
  background: #f59e0b;
  color: #1a1200;
  font-weight: 700;
}

.btn-warning:hover {
  background: #d97706;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--color-success);
  color: #06261c;
  font-weight: 700;
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: var(--color-danger);
  color: #fff;
}

.btn-lg {
  padding: 12px 20px;
  font-size: 0.95rem;
  flex: 1;
}

/* Workspace Grid (Bento) */
.workspace-grid {
  display: grid;
  grid-template-columns: 360px 440px 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0; /* Important for inner scrolling */
}

.bento-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Queue List */
.queue-card .card-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 16px 18px;
}

.filter-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: 8px;
  width: 100%;
}

.filter-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 6px 2px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
}

.filter-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-weight: 600;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.filter-btn.active .tab-badge {
  background: rgba(99, 102, 241, 0.4);
  color: #fff;
}

.queue-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.queue-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.queue-item.active {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

.queue-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.queue-item-id {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.item-status-pill {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}

.status-pending { background: var(--color-warning-bg); color: var(--color-warning); }
.status-approved { background: var(--color-success-bg); color: var(--color-success); }
.status-rejected { background: var(--color-danger-bg); color: var(--color-danger); }

.queue-item-topic {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
}

.queue-item-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Center Phone Mockup */
.preview-card {
  align-items: center;
  background: radial-gradient(circle at 50% 30%, rgba(99, 102, 241, 0.05) 0%, rgba(18, 23, 34, 1) 100%);
}

.preview-header {
  width: 100%;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.platform-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: 8px;
}

.platform-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.platform-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.preview-resolution-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.phone-mockup-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  width: 100%;
}

.phone-frame {
  width: 320px;
  height: 570px; /* 9:16 approx scaled */
  background: #000;
  border-radius: var(--radius-phone);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-phone);
  border: 4px solid #2d3748;
}

.phone-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 20px;
  background: #000;
  border-radius: 12px;
  z-index: 20;
}

.phone-screen {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #111;
}

.screen-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* TikTok Overlay Mockup */
.tiktok-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 40%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  z-index: 10;
  color: #fff;
  pointer-events: none;
}

.tt-right-actions {
  position: absolute;
  right: 12px;
  bottom: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.tt-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.tt-icon { font-size: 1.3rem; }
.tt-count { font-size: 0.65rem; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }

.tt-sound-disc img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #333;
  animation: spin 6s linear infinite;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

.tt-bottom-info {
  margin-right: 50px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tt-author {
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tt-verify-check {
  font-size: 0.65rem;
  background: #20d5ec;
  color: #000;
  border-radius: 50%;
  padding: 1px 3px;
}

.tt-caption {
  font-size: 0.78rem;
  line-height: 1.3;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tt-sound-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  margin-top: 4px;
  opacity: 0.9;
}

/* Instagram Overlay Mockup */
.ig-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, transparent 20%, transparent 70%, rgba(0, 0, 0, 0.9) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 14px 14px 14px;
  z-index: 10;
  color: #fff;
  pointer-events: none;
}

.ig-top-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ig-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.ig-user-details {
  display: flex;
  flex-direction: column;
}

.ig-username { font-size: 0.78rem; font-weight: 700; }
.ig-location { font-size: 0.65rem; opacity: 0.8; }

.ig-caption-box {
  font-size: 0.75rem;
  line-height: 1.3;
}

.ig-caption-user { font-weight: 700; margin-right: 4px; }

.hidden { display: none !important; }

/* Right Column: Inspector */
.inspector-card {
  display: flex;
  flex-direction: column;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

.inspector-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.inspector-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.topic-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pillar-tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 3px 10px;
  border-radius: 6px;
}

.hook-quote {
  font-size: 0.92rem;
  font-style: italic;
  color: #e2e8f0;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--accent-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.compliance-checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.check-item {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.check-item.passed { color: var(--color-success); }

.prompt-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: monospace;
  max-height: 90px;
  overflow-y: auto;
  line-height: 1.4;
}

.anchor-verified-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 4px;
}

.input-notes {
  width: 100%;
  height: 60px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-family: var(--font-main);
  resize: none;
}

.input-notes:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.inspector-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

/* Upload Box */
.upload-box {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-box:hover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.05);
}

.upload-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.3;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent-primary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  padding: 24px;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.master-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 100;
  transition: all 0.3s ease;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.pill-btn.active {
  background: var(--primary-accent, #6366f1);
  border-color: var(--primary-accent, #6366f1);
  color: #fff;
}

/* ==========================================================================
   Mobile & Responsive Adaptations (Smartphones & Tablets)
   ========================================================================== */

@media (max-width: 1024px) {
  .app-layout {
    height: auto;
    min-height: 100vh;
    padding: 12px;
    gap: 12px;
  }

  .workspace-grid {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: auto;
    gap: 14px;
  }

  .bento-card {
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .inspector-card {
    order: 1;
  }

  .preview-card {
    order: 2;
  }

  .queue-card {
    order: 3;
  }

  .phone-mockup-wrapper {
    height: auto;
    padding: 16px 0;
  }

  .phone-frame {
    width: 100%;
    max-width: 320px;
    height: 560px;
    margin: 0 auto;
  }

  .queue-list {
    max-height: 350px;
    overflow-y: auto;
  }

  .inspector-content {
    overflow-y: visible;
  }
}

@media (max-width: 768px) {
  body {
    background-attachment: scroll;
  }

  .app-layout {
    padding: 8px;
    gap: 10px;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px;
  }

  .brand-container {
    justify-content: flex-start;
    width: 100%;
  }

  .header-actions {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .header-actions .btn-primary {
    flex: 1;
    min-height: 44px;
    font-size: 0.95rem;
  }

  .stats-pills {
    display: flex;
    gap: 6px;
  }

  .stat-pill {
    padding: 4px 10px;
    font-size: 0.78rem;
  }

  .card-header {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .filter-tabs {
    width: 100%;
    display: flex;
    justify-content: space-between;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .filter-btn {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 0.78rem;
  }

  .inspector-content {
    padding: 14px;
    gap: 12px;
  }

  .btn-lg {
    min-height: 48px;
    font-size: 1rem;
  }

  #btn-copy-instagram {
    padding: 16px 20px !important;
    font-size: 1.05rem !important;
    min-height: 52px;
  }

  .input-notes {
    font-size: 16px; /* Prevents auto-zoom in iOS Safari */
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    text-align: center;
    font-size: 0.9rem;
    padding: 14px;
  }

  .modal-card {
    width: 96%;
    padding: 16px;
    max-height: 90vh;
  }
}

