:root {
  --bg-main: #0c0d14;
  --bg-card: #151724;
  --bg-card-alt: #1a1d2e;
  --bg-input: #11121d;
  --border: #23273e;
  --border-focus: #ff7849;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --accent-blue: #38bdf8;
  --accent-pink: #f43f5e;
  --accent-yellow: #f59e0b;
  --accent-green: #10b981;
  --radius: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  padding: 24px;
}

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

.header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header h1 span {
  color: #ff7849;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge {
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-purple {
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Grid Layout */
.grid-container {
  display: grid;
  grid-template-columns: 360px 420px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1280px) {
  .grid-container {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 840px) {
  .grid-container {
    grid-template-columns: 1fr;
  }
}

.col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
}

.card-blue { border-color: rgba(56, 189, 248, 0.25); }
.card-purple { border-color: rgba(139, 92, 246, 0.25); }
.card-pink { border-color: rgba(244, 63, 94, 0.25); }

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

.card-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title.blue { color: #38bdf8; }
.card-title.purple { color: #c084fc; }
.card-title.pink { color: #fb7185; }
.card-title.yellow { color: #fbbf24; }

.select-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

select, input[type="text"], input[type="number"], textarea {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid rgba(255, 120, 73, 0.6);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease;
}

select:focus, input:focus, textarea:focus {
  border-color: #ff7849;
  box-shadow: 0 0 0 2px rgba(255, 120, 73, 0.2);
}

.card-subtext {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: 6px;
}

/* Buttons */
button {
  background: var(--bg-card-alt);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

button:hover {
  background: #252a42;
  border-color: #3f466b;
}

button.primary {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #fff;
  border: none;
}

button.primary:hover {
  background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
}

button.secondary {
  background: #23273e;
  border-color: #3b4267;
}

button.icon-btn {
  padding: 8px 10px;
}

/* Product List */
.product-search-box {
  margin-bottom: 8px;
}

.btn-group {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.btn-group button {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.8rem;
}

.product-scroll-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(10, 11, 18, 0.6);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(26, 29, 46, 0.6);
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.product-item:hover {
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(26, 29, 46, 0.9);
}

.product-item input[type="checkbox"] {
  accent-color: #f97316;
  width: 16px;
  height: 16px;
}

.product-thumb {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  object-fit: cover;
  background: #000;
  border: 1px solid var(--border);
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-title-text {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #e2e8f0;
}

.product-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.related-link-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.related-link-section label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #c084fc;
  display: block;
  margin-bottom: 4px;
}

/* Upload Model Box */
.upload-dropzone {
  border: 1px dashed rgba(139, 92, 246, 0.4);
  background: rgba(17, 18, 29, 0.7);
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 10px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-dropzone:hover {
  border-color: #a855f7;
  color: #e2e8f0;
}

.upload-preview {
  max-height: 120px;
  border-radius: 6px;
  margin-top: 8px;
  object-fit: cover;
  display: none;
}

/* Queue Table & Logs */
.table-responsive {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

th {
  background: #1a1d2e;
  padding: 8px 12px;
  color: #94a3b8;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(35, 39, 62, 0.5);
  color: #cbd5e1;
}

.log-box {
  background: #090a0f;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  height: 220px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.75rem;
  color: #38bdf8;
  white-space: pre-wrap;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(5px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #10121d;
  border: 1px solid #23273e;
  border-radius: var(--radius);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

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

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.proxy-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr 2fr;
  gap: 8px;
  margin-bottom: 10px;
}

@media (max-width: 600px) {
  .proxy-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.proxy-status-pill {
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 6px;
  margin-top: 8px;
  display: inline-block;
  font-weight: 500;
}

.proxy-status-pill.valid {
  color: #34d399;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.proxy-status-pill.invalid {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.account-status-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.account-status-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 6px;
  background: rgba(26, 29, 46, 0.7);
  border: 1px solid var(--border);
}

.account-status-card:hover {
  border-color: rgba(139, 92, 246, 0.4);
}

.account-status-info {
  font-size: 0.83rem;
  color: #e2e8f0;
}

.account-status-actions {
  display: flex;
  gap: 6px;
}

button.teal {
  background: #0d9488;
  color: #fff;
  border: none;
}

button.teal:hover {
  background: #0f766e;
}

/* ==========================================
   NAVIGATION TABS & MULTI-VIEW SYSTEM
   ========================================== */

.nav-tabs-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #11121d;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.nav-tab-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.nav-tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-tab-btn.active {
  background: #23273e;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.view-section {
  display: none;
  animation: fadeIn 0.15s ease;
}

.view-section.active {
  display: block;
}

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

/* ==========================================
   ANALYST ACCOUNT STYLES
   ========================================== */

.analyst-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.analyst-table-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.analyst-table {
  width: 100%;
  border-collapse: collapse;
}

.analyst-table th {
  background: #11121d;
  padding: 12px 14px;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.analyst-table td {
  padding: 12px 14px;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.analyst-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #23273e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #38bdf8;
  margin-right: 10px;
}

.analyst-user-cell {
  display: flex;
  align-items: center;
}

/* ==========================================
   PROMPT MANAGEMENT STYLES
   ========================================== */

.prompt-mgmt-layout {
  display: grid;
  grid-template-columns: 220px 1fr 340px;
  gap: 16px;
}

@media (max-width: 1200px) {
  .prompt-mgmt-layout {
    grid-template-columns: 1fr;
  }
}

.country-rules-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.country-rule-item {
  padding: 10px 14px;
  border-radius: 6px;
  background: #11121d;
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.country-rule-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.country-rule-item.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: #38bdf8;
  color: #38bdf8;
}

/* ==========================================
   KALODATA IMPORT CSV STYLES
   ========================================== */

.kalodata-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .kalodata-layout {
    grid-template-columns: 1fr;
  }
}

.csv-dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 30px 20px;
  text-align: center;
  background: rgba(17, 18, 29, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
}

.csv-dropzone:hover {
  border-color: #ff7849;
  background: rgba(255, 120, 73, 0.04);
}

.account-chip {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  background: #11121d;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  width: 100%;
  margin-bottom: 6px;
  font-size: 0.82rem;
}

/* ==========================================
   MODEL AI CONFIG STYLES
   ========================================== */

.ai-providers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.ai-provider-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
}

.ai-provider-card.active-provider {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.08);
}

/* ==========================================
   DESKTOP TITLEBAR & VIBOT LAUNCHER GRID
   ========================================== */

.desktop-titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 36px;
  background: #08090f;
  border-bottom: 1px solid var(--border);
  padding: 0 0 0 12px;
  -webkit-app-region: drag;
  user-select: none;
  font-size: 0.75rem;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.desktop-titlebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.desktop-titlebar-controls {
  display: flex;
  align-items: center;
  -webkit-app-region: no-drag;
}

.titlebar-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 44px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.titlebar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.titlebar-btn.close-btn:hover {
  background: #f43f5e;
  color: #fff;
}

/* Vibot-Style Launcher Grid */
.launcher-container {
  max-width: 860px;
  margin: 20px auto;
  padding: 10px;
}

.launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (min-width: 680px) {
  .launcher-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 900px) {
  .launcher-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.launcher-card {
  background: #131522;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 120px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.launcher-card:hover {
  transform: translateY(-5px);
  background: #1a1e32;
  border-color: #38bdf8;
  box-shadow: 0 8px 25px rgba(56, 189, 248, 0.18);
}

.launcher-card.active-app {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

.launcher-card-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.launcher-card-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f1f5f9;
  text-align: center;
}
