/* ========== Variables ========== */
:root {
  --orange: #f97316;
  --orange-dark: #ea580c;
  --cream: #f5f0e8;
  --white: #ffffff;
  --dark: #1a1a2e;
  --text: #333;
  --text-light: #999;
  --border: #e5e5e5;
  --red: #ef4444;
  --green: #10b981;
  --sidebar-w: 240px;
  --radius: 12px;
}

/* ========== Reset ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Poppins', sans-serif;
  background: var(--cream);
  color: var(--dark);
  min-height: 100vh;
}

/* ========== Login ========== */
.login-container {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.login-box {
  background: var(--white); border-radius: 20px; padding: 40px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08); max-width: 380px;
  width: 100%; text-align: center;
}
.login-box h1 { font-size: 1.4rem; margin-bottom: 4px; font-weight: 700; }
.login-box .subtitle { color: var(--text-light); font-size: 0.85rem; margin-bottom: 28px; }
.pin-inputs { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; }
.pin-input {
  width: 60px; height: 68px; border: 2px solid var(--border); border-radius: 14px;
  text-align: center; font-size: 1.8rem; font-weight: 700; font-family: inherit;
  color: var(--dark); transition: all 0.3s; caret-color: var(--orange);
}
.pin-input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249,115,22,0.1); }
.pin-input.filled { border-color: var(--orange); }
.pin-input.error { border-color: var(--red); animation: pinShake 0.4s ease; }
@keyframes pinShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.btn-login {
  width: 100%; padding: 14px; background: var(--border); color: var(--text-light);
  border: none; border-radius: var(--radius); font-size: 1rem; font-weight: 600;
  cursor: not-allowed; font-family: inherit; transition: all 0.3s;
}
.btn-login.ready { background: var(--orange); color: var(--white); cursor: pointer; }
.btn-login.ready:hover { background: var(--orange-dark); }
.login-error { color: var(--red); font-size: 0.85rem; margin-top: 12px; display: none; }

/* ========== App Shell ========== */
.app-container { display: none; min-height: 100vh; }

/* Sidebar */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w); background: var(--white);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
}
.sidebar-header {
  padding: 24px 20px 16px; border-bottom: 1px solid var(--border);
}
.sidebar-header h1 { font-size: 1.1rem; font-weight: 700; }
.sidebar-header span { font-size: 0.75rem; color: var(--text-light); font-weight: 500; }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  cursor: pointer; color: #666; font-weight: 500;
  font-size: 0.88rem; transition: all 0.2s;
  border: none; background: none; width: 100%; text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: rgba(249,115,22,0.06); color: var(--dark); }
.nav-item.active { background: rgba(249,115,22,0.1); color: var(--orange); font-weight: 600; }
.nav-item .icon { font-size: 1.1rem; width: 24px; text-align: center; }
.nav-divider { height: 1px; background: var(--border); margin: 8px 14px; }
.sidebar-footer {
  padding: 12px 10px; border-top: 1px solid var(--border);
}
.btn-logout {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px; border-radius: 10px;
  border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 0.85rem;
  color: #666; font-weight: 500; transition: all 0.2s;
}
.btn-logout:hover { background: rgba(239,68,68,0.06); color: var(--red); }

/* Main content */
.main-content {
  margin-left: var(--sidebar-w); padding: 30px 40px;
  min-height: 100vh;
}

/* ========== Common Components ========== */
.section-title h2 { font-size: 1.3rem; font-weight: 700; }
.section-title p { color: var(--text-light); font-size: 0.85rem; margin-bottom: 24px; }

/* Tabs */
.tabs, .dex-tabs {
  display: flex; gap: 0; margin-bottom: 20px;
  border-bottom: 2px solid var(--border); flex-wrap: wrap;
}
.tab {
  padding: 10px 20px; cursor: pointer; font-weight: 600;
  color: var(--text-light); border: none; background: none;
  border-bottom: 3px solid transparent; transition: all 0.3s;
  font-size: 0.88rem; font-family: inherit; margin-bottom: -2px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--orange); border-bottom-color: var(--orange); }

/* Buttons */
.btn-primary {
  background: var(--orange); color: var(--white); border: none;
  padding: 10px 24px; border-radius: 10px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: background 0.3s;
  font-size: 0.88rem;
}
.btn-primary:hover { background: var(--orange-dark); }
.btn-secondary {
  background: var(--white); color: var(--text); border: 1px solid var(--border);
  padding: 10px 18px; border-radius: 10px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all 0.3s;
  font-size: 0.85rem;
}
.btn-secondary:hover { border-color: var(--orange); color: var(--orange); }
.btn-link {
  background: none; border: none; color: var(--orange);
  font-weight: 600; cursor: pointer; font-family: inherit;
  font-size: 0.85rem; padding: 6px 0;
}
.btn-link:hover { text-decoration: underline; }
.btn-sm {
  background: var(--white); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 8px; font-size: 0.8rem;
  font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all 0.2s;
}
.btn-sm:hover { border-color: var(--orange); color: var(--orange); }
.btn-sm.danger { color: var(--red); border-color: var(--red); }
.btn-sm.danger:hover { background: var(--red); color: var(--white); }
.btn-sm:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-danger-full {
  width: 100%; padding: 12px; border-radius: 10px;
  background: var(--red); color: var(--white); border: none;
  font-weight: 600; cursor: pointer; font-family: inherit;
  margin-top: 16px; font-size: 0.9rem;
}
.btn-danger-full:hover { background: #dc2626; }
.btn-load-more {
  display: block; width: 100%; padding: 12px;
  background: var(--white); border: 2px solid var(--border);
  border-radius: 10px; font-weight: 600; cursor: pointer;
  font-family: inherit; color: var(--text-light); margin-top: 16px;
  transition: all 0.2s;
}
.btn-load-more:hover { border-color: var(--orange); color: var(--orange); }

/* Content header */
.content-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.project-count { font-size: 0.9rem; color: var(--text-light); font-weight: 500; }

/* ========== Dashboard ========== */
.dash-block {
  background: var(--white); border-radius: var(--radius);
  padding: 20px 24px; margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.dash-block h3 { font-size: 1rem; margin-bottom: 14px; font-weight: 600; }
.dash-block-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.dash-block-header h3 { margin-bottom: 0; }
.dash-loading { text-align: center; color: var(--text-light); padding: 60px 0; }

.stats-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--cream); border-radius: 10px;
  padding: 16px; text-align: center;
}
.stat-card.accent { background: rgba(249,115,22,0.08); }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--dark); }
.stat-label { font-size: 0.75rem; color: var(--text-light); margin-top: 2px; font-weight: 500; }

/* ========== Project List ========== */
.project-list { display: flex; flex-direction: column; gap: 10px; }
.project-item {
  background: var(--white); border-radius: var(--radius); padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04); transition: all 0.3s;
}
.project-item:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.project-thumb {
  width: 80px; height: 50px; border-radius: 8px;
  object-fit: cover; background: #eee; flex-shrink: 0;
}
.project-meta { flex: 1; min-width: 0; }
.project-meta h3 { font-size: 0.92rem; font-weight: 600; }
.project-meta p {
  font-size: 0.78rem; color: var(--text-light);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.project-badge {
  background: rgba(249,115,22,0.1); color: var(--orange);
  padding: 4px 10px; border-radius: 6px; font-size: 0.7rem;
  font-weight: 600; text-transform: uppercase; flex-shrink: 0;
}
.project-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-icon {
  width: 34px; height: 34px; border-radius: 8px; border: 2px solid var(--border);
  background: var(--white); cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all 0.3s; font-size: 0.95rem;
}
.btn-icon:hover { border-color: var(--orange); color: var(--orange); }
.btn-icon.delete:hover { border-color: var(--red); color: var(--red); }
.order-arrows { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.btn-arrow {
  width: 26px; height: 18px; border: 1px solid #ddd; background: var(--white);
  cursor: pointer; border-radius: 4px; font-size: 0.65rem;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.btn-arrow:hover { background: var(--orange); color: var(--white); border-color: var(--orange); }
.btn-arrow:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-arrow:disabled:hover { background: var(--white); color: inherit; border-color: #ddd; }

.empty-state { text-align: center; padding: 50px; color: var(--text-light); font-size: 0.9rem; }

/* ========== Modal ========== */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--white); border-radius: 20px; padding: 28px;
  max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto;
}
.modal h2 { font-size: 1.15rem; margin-bottom: 18px; }
.modal-header-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.modal-header-bar h3 { font-size: 1.05rem; }
.modal-close {
  background: none; border: none; font-size: 1.6rem;
  cursor: pointer; color: var(--text-light); line-height: 1;
}
.modal-img {
  width: 100%; max-height: 300px; object-fit: contain;
  border-radius: 10px; background: #f5f5f5; margin-bottom: 14px;
}
.modal-meta {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 0.82rem; color: #555; margin-bottom: 14px;
}
.modal-analysis {
  font-size: 0.85rem; line-height: 1.6; color: var(--text);
  background: var(--cream); padding: 14px; border-radius: 10px;
  max-height: 200px; overflow-y: auto;
}

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 0.82rem; font-weight: 600;
  margin-bottom: 5px; color: #555;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select {
  width: 100%; padding: 10px 13px; border: 2px solid var(--border);
  border-radius: 10px; font-size: 0.88rem; font-family: inherit;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--orange);
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-row.three .form-group { flex: 1; min-width: 0; }
.modal-actions { display: flex; gap: 12px; margin-top: 20px; }
.modal-actions button { flex: 1; padding: 12px; border-radius: 10px; font-weight: 600; cursor: pointer; font-family: inherit; font-size: 0.9rem; }
.btn-cancel { background: #f5f5f5; border: none; color: #666; }
.btn-cancel:hover { background: #eee; }
.btn-save { background: var(--orange); border: none; color: var(--white); }
.btn-save:hover { background: var(--orange-dark); }

/* Thumbnail section */
.thumb-section { margin-bottom: 14px; }
.thumb-section > label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 5px; color: #555; }
.thumb-tabs { display: flex; gap: 0; margin-bottom: 10px; border-bottom: 2px solid var(--border); }
.thumb-tab {
  padding: 7px 12px; cursor: pointer; font-size: 0.76rem; font-weight: 600;
  color: var(--text-light); border: none; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.3s;
  font-family: inherit;
}
.thumb-tab:hover { color: var(--text); }
.thumb-tab.active { color: var(--orange); border-bottom-color: var(--orange); }
.thumb-content { display: none; }
.thumb-content.active { display: block; }
.paste-zone {
  border: 2px dashed #ddd; border-radius: 10px; padding: 28px;
  text-align: center; color: var(--text-light); font-size: 0.82rem;
  cursor: pointer; transition: all 0.3s;
}
.paste-zone:hover, .paste-zone:focus { border-color: var(--orange); color: var(--orange); background: rgba(249,115,22,0.03); outline: none; }
.thumb-preview { margin-top: 10px; text-align: center; }
.thumb-preview img {
  max-width: 100%; max-height: 160px; border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1); display: none;
}
.btn-remove-thumb {
  background: none; border: none; color: var(--red); font-size: 0.78rem;
  font-weight: 600; cursor: pointer; margin-top: 6px; display: none;
  font-family: inherit;
}
.btn-remove-thumb:hover { text-decoration: underline; }

/* ========== Images Grid ========== */
.images-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; margin-top: 14px;
}
.image-card {
  position: relative; aspect-ratio: 3/4; border-radius: 10px;
  overflow: hidden; cursor: pointer; background: #eee;
  transition: transform 0.2s;
}
.image-card:hover { transform: scale(1.02); }
.image-card img {
  width: 100%; height: 100%; object-fit: cover;
}
.image-card .overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: var(--white); padding: 10px; font-size: 0.72rem;
}
.image-card .category {
  background: rgba(255,255,255,0.2); padding: 2px 8px;
  border-radius: 4px; font-size: 0.68rem; text-transform: uppercase;
  font-weight: 600;
}
.image-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light);
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border); border-top-color: var(--orange);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Selection mode */
.select-actions { display: flex; align-items: center; gap: 8px; }
.select-toolbar {
  display: none; align-items: center; justify-content: space-between;
  background: rgba(239,68,68,0.06); padding: 10px 14px; border-radius: 8px;
  margin-bottom: 10px; font-size: 0.82rem;
}
.select-toolbar.active { display: flex; }
.select-toolbar div { display: flex; gap: 8px; }
.image-card .select-check {
  display: none; position: absolute; top: 8px; left: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--white); background: rgba(0,0,0,0.3);
  z-index: 2;
}
.image-card.selectable .select-check { display: block; }
.image-card.selected .select-check {
  background: var(--orange); border-color: var(--orange);
}
.image-card.selected .select-check::after {
  content: '✓'; color: var(--white); font-size: 0.7rem;
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-weight: 700;
}

/* ========== Settings ========== */
.settings-card {
  background: var(--white); border-radius: var(--radius);
  padding: 20px 24px; margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.settings-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.settings-info {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 0.85rem; color: #555;
}
.settings-form { margin-top: 14px; max-width: 320px; }
.settings-note {
  font-size: 0.8rem; color: var(--text-light); margin-top: 8px;
}
.settings-note code {
  background: var(--cream); padding: 2px 6px; border-radius: 4px;
  font-size: 0.78rem;
}
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.key-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.key-name { font-weight: 500; }
.key-status { font-family: monospace; font-size: 0.85rem; }
.key-status.configured { color: var(--green); }
.key-status.missing { color: var(--text-light); }
.limit-group { margin-bottom: 16px; }
.limit-group h4 { font-size: 0.88rem; font-weight: 600; margin-bottom: 8px; color: var(--orange); }

/* ========== Toast ========== */
.toast {
  position: fixed; bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--green); color: var(--white);
  padding: 12px 24px; border-radius: 8px;
  font-weight: 600; font-size: 0.88rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  opacity: 0; transition: all 0.3s; z-index: 2000;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }

/* ========== Responsive ========== */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 20px; }
  .mobile-header {
    display: flex !important;
    align-items: center; gap: 12px;
    padding: 16px 0; margin-bottom: 8px;
  }
  .btn-menu {
    display: flex !important;
    width: 40px; height: 40px; border-radius: 10px;
    border: 2px solid var(--border); background: var(--white);
    align-items: center; justify-content: center; cursor: pointer;
    font-size: 1.2rem;
  }
  .mobile-header h2 { font-size: 1rem; font-weight: 600; }
  .mobile-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.3); z-index: 99;
  }
  .mobile-overlay.show { display: block; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; gap: 0; }
  .project-badge { display: none; }
  .tabs, .dex-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; padding: 8px 14px; font-size: 0.8rem; }
}

@media (min-width: 769px) {
  .mobile-header { display: none !important; }
  .btn-menu { display: none !important; }
  .mobile-overlay { display: none !important; }
}

/* ========== Chats Section ========== */
.chats-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid #e0d5c5;
  background: #fff;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover { border-color: var(--orange); }
.filter-btn.active { background: var(--orange); color: #fff; border-color: var(--orange); }

.chats-summary {
  padding: 10px 0;
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.chats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-item {
  background: #fff;
  border-radius: 10px;
  padding: 14px 18px;
  border: 1px solid #e8e0d5;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-item:hover { border-color: var(--orange); box-shadow: 0 2px 8px rgba(249, 115, 22, 0.1); }

.chat-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.chat-item-app {
  background: var(--orange);
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.chat-item-date {
  color: var(--text-light);
  font-size: 0.8rem;
}

.chat-item-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-light);
  font-size: 0.8rem;
}

.chat-item-visitor {
  font-family: monospace;
  font-size: 0.75rem;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-size: 0.95rem;
}

.chat-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.chat-detail-analysis {
  background: #fff;
  border: 1px solid #e8e0d5;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.chat-detail-analysis summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.chat-detail-analysis pre {
  margin-top: 10px;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
  color: var(--text-light);
}

.chat-detail-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-detail-msg {
  background: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  border: 1px solid #e8e0d5;
}

.chat-detail-user { border-left: 3px solid var(--orange); }
.chat-detail-ai { border-left: 3px solid #10b981; }

.chat-detail-role {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.chat-detail-user .chat-detail-role { color: var(--orange); }
.chat-detail-ai .chat-detail-role { color: #10b981; }

.chat-detail-text {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ========== Activity Section ========== */
.activity-visitor-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.activity-visitor-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 18px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.activity-visitor-card:hover {
  border-color: var(--orange);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.activity-visitor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.activity-visitor-id {
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark);
}
.activity-visitor-apps {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.activity-app-badge {
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
}
.activity-visitor-counts {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Activity detail */
.activity-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.activity-detail-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}
.activity-detail-count {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Activity timeline */
.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.activity-item {
  display: flex;
  gap: 14px;
  background: #fff;
  border-radius: 10px;
  padding: 14px 18px;
  border: 1px solid #e8e0d5;
  cursor: pointer;
  transition: all 0.2s;
}
.activity-item:hover {
  border-color: var(--orange);
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.1);
}
.activity-item-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}
.activity-item-content {
  flex: 1;
  min-width: 0;
}
.activity-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.activity-item-category {
  background: var(--cream);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text);
}
.activity-item-preview {
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Activity detail item */
.activity-detail-item {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.activity-detail-meta {
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 14px;
}

/* ========== Dashboard Alert ========== */
.dash-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.dash-alert-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.dash-alert-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}
.dash-alert-content p {
  font-size: 0.85rem;
  color: #92400e;
  margin-top: 4px;
}
.dash-alert-content strong {
  color: #92400e;
}
.btn-alert-action {
  background: #f59e0b;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
.btn-alert-action:hover { background: #d97706; }

.dash-block-warning {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

/* ========== Cleanup Section ========== */
.cleanup-desc {
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 16px;
}
.cleanup-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.cleanup-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}
.btn-danger:hover { background: #dc2626; }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

.cleanup-subtitle {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--dark);
}
.cleanup-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cleanup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--cream);
  border-radius: 8px;
  font-size: 0.83rem;
  cursor: pointer;
}
.cleanup-item:hover { background: #ede8de; }
.cleanup-item-app {
  background: var(--orange);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}
.cleanup-item-info {
  flex: 1;
  color: var(--text);
}
.cleanup-item-age {
  color: var(--red);
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ========== Accounts Section ========== */
.accounts-search {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.accounts-search input {
  flex: 1;
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.accounts-search input:focus {
  outline: none;
  border-color: var(--orange);
}
.accounts-summary {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 12px;
}
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.account-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}
.account-card:hover {
  border-color: var(--orange);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.account-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.account-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--cream);
  flex-shrink: 0;
}
.account-avatar-placeholder {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.account-info {
  flex: 1;
  min-width: 0;
}
.account-name {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-email {
  font-size: 0.78rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Account detail view */
.account-detail {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.account-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.account-detail-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--cream);
}
.account-detail-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
}
.account-detail-info p {
  font-size: 0.85rem;
  color: var(--text-light);
}
.account-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.account-detail-meta-item {
  background: var(--cream);
  padding: 12px;
  border-radius: 8px;
}
.account-detail-meta-item label {
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}
.account-detail-meta-item span {
  font-size: 0.88rem;
  font-weight: 500;
}
.account-data-counts {
  margin-bottom: 20px;
}
.account-data-counts h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.account-visitors {
  margin-bottom: 20px;
}
.account-visitors h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.visitor-id-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.visitor-id-tag {
  background: var(--cream);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text);
}
.account-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
  .dash-alert {
    flex-direction: column;
    align-items: flex-start;
  }
  .cleanup-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  .accounts-grid {
    grid-template-columns: 1fr;
  }
  .account-detail-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ========== LinkPathTracer ========== */
.lt-links-list {
  display: flex; flex-direction: column; gap: 12px; margin-top: 16px;
}
.lt-link-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 20px; align-items: center;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  transition: border-color .2s, transform .2s;
}
.lt-link-card:hover { border-color: var(--orange); }
.lt-link-name { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.lt-link-target {
  color: var(--text-light); font-size: .8rem; margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 480px;
}
.lt-link-tracking {
  display: flex; align-items: center; gap: 8px;
  background: var(--cream); border-radius: 8px; padding: 6px 10px; width: fit-content;
}
.lt-link-tracking code {
  font-family: 'Menlo', 'Consolas', monospace; font-size: .85rem; color: var(--dark);
}
.lt-link-stats { text-align: center; min-width: 90px; }
.lt-stat-clicks { font-size: 1.8rem; font-weight: 800; color: var(--orange); line-height: 1; }
.lt-stat-label { font-size: .7rem; color: var(--text-light); text-transform: uppercase; letter-spacing: .5px; }
.lt-stat-last { font-size: .75rem; color: var(--text-light); margin-top: 4px; }
.lt-link-actions { display: flex; gap: 6px; }

.lt-modal-hint {
  font-size: .8rem; color: var(--text-light); margin-top: 8px; line-height: 1.5;
}
.lt-modal-hint code {
  background: var(--cream); padding: 2px 6px; border-radius: 4px;
  font-family: 'Menlo', 'Consolas', monospace; font-size: .8rem;
}
.lt-itype-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px;
}
.lt-itype {
  position: relative;
  display: block; cursor: pointer;
  border: 2px solid var(--border); border-radius: 10px;
  padding: 12px 8px; text-align: center;
  transition: all .15s; background: var(--white);
}
.lt-itype input { position: absolute; opacity: 0; pointer-events: none; }
.lt-itype:hover { border-color: var(--orange); }
.lt-itype.selected {
  border-color: var(--orange);
  background: rgba(249,115,22,.06);
  box-shadow: 0 0 0 3px rgba(249,115,22,.08);
}
.lt-itype-icon { font-size: 1.6rem; line-height: 1; margin-bottom: 4px; }
.lt-itype-name { font-weight: 700; font-size: .85rem; }
.lt-itype-desc { font-size: .7rem; color: var(--text-light); margin-top: 2px; }
.lt-cond textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-family: inherit; font-size: .9rem;
  resize: vertical; min-height: 70px;
}
.lt-i-badge {
  display: inline-block; margin-left: 8px;
  font-size: .7rem; padding: 2px 8px; border-radius: 6px;
  background: rgba(249,115,22,.12); color: var(--orange-dark);
  font-weight: 600; vertical-align: middle;
}
.lt-i-badge.lt-i-chat {
  background: rgba(16,185,129,.15); color: #047857;
}
.lt-i-badge.lt-i-rmode {
  background: rgba(99,102,241,.14); color: #4338ca;
}

.lt-rmode-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px;
}
.lt-rmode {
  position: relative; display: block; cursor: pointer;
  border: 2px solid var(--border); border-radius: 10px;
  padding: 12px 8px; text-align: center;
  transition: all .15s; background: var(--white);
}
.lt-rmode input { position: absolute; opacity: 0; pointer-events: none; }
.lt-rmode:hover { border-color: var(--orange); }
.lt-rmode.selected {
  border-color: var(--orange);
  background: rgba(249,115,22,.06);
  box-shadow: 0 0 0 3px rgba(249,115,22,.08);
}
.lt-rmode.disabled {
  opacity: .4; cursor: not-allowed; pointer-events: none;
}
.lt-rmode-icon { font-size: 1.5rem; line-height: 1; margin-bottom: 4px; }
.lt-rmode-name { font-weight: 700; font-size: .8rem; }
.lt-rmode-desc { font-size: .68rem; color: var(--text-light); margin-top: 2px; line-height: 1.3; }
.lt-rmode-hint {
  display: block; font-size: .75rem; color: var(--text-light);
  margin-top: 8px; line-height: 1.4;
}
.lt-checkbox-label {
  display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  font-weight: 400 !important; line-height: 1.45;
}
.lt-checkbox-label input[type="checkbox"] {
  margin-top: 3px; width: 18px; height: 18px; cursor: pointer; flex-shrink: 0;
}
.lt-checkbox-label small { color: var(--text-light); font-size: .8rem; }

/* QR Modal */
.lt-qr-modal { max-width: 420px; }
.lt-qr-name {
  font-weight: 600; color: var(--text-light); font-size: .9rem;
  margin: -8px 0 16px;
}
.lt-qr-canvas-wrap {
  display: flex; justify-content: center; padding: 16px;
  background: var(--cream); border-radius: 12px; margin-bottom: 14px;
}
.lt-qr-canvas-wrap canvas { display: block; max-width: 100%; height: auto; }
.lt-qr-url {
  display: block; padding: 10px 12px; background: var(--cream);
  border-radius: 8px; font-family: 'Menlo', 'Consolas', monospace;
  font-size: .8rem; word-break: break-all; margin-bottom: 12px;
  color: var(--dark);
}

/* Live visitors panel */
.lt-mstat-live { background: linear-gradient(135deg, rgba(16,185,129,.08), rgba(16,185,129,.04)) !important; }
.lt-mstat-live .lt-mstat-num { color: #10b981 !important; }

.lt-live-panel {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.lt-live-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 12px; flex-wrap: wrap;
}
.lt-live-header h3 { font-size: 1rem; font-weight: 700; }
.lt-live-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 340px; overflow-y: auto;
}
.lt-live-card {
  display: grid; grid-template-columns: 48px 1fr auto;
  gap: 12px; align-items: center;
  padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--cream);
  cursor: pointer; transition: all .2s;
}
.lt-live-card:hover { border-color: var(--orange); transform: translateX(2px); }
.lt-live-card.active { border-color: #10b981; background: rgba(16,185,129,.06); }
.lt-live-flag {
  font-size: 1.6rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  background: var(--white); border-radius: 10px;
}
.lt-live-row1 { display: flex; justify-content: space-between; gap: 8px; }
.lt-live-row1 strong { font-size: .9rem; }
.lt-live-time { font-size: .7rem; color: var(--text-light); white-space: nowrap; }
.lt-live-row2 { font-size: .8rem; color: var(--text-light); margin-top: 2px; }
.lt-live-last {
  font-size: .8rem; color: var(--dark); margin-top: 4px;
  font-style: italic; opacity: .8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lt-live-pending {
  display: inline-block; color: #ef4444;
  margin-right: 4px; animation: ltPulse 1s infinite;
}
.lt-live-chat-btn {
  pointer-events: none; padding: 8px 14px; font-size: .8rem;
}

/* Admin chat overlay */
.lt-chat-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.lt-chat-overlay.show { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lt-chat-card {
  background: var(--white); border-radius: 16px;
  width: 480px; max-width: 100%; height: 600px; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
}
.lt-chat-card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.lt-chat-card-title { font-weight: 700; font-size: 1rem; }
.lt-chat-card-sub { font-size: .8rem; color: var(--text-light); margin-top: 2px; }
.lt-chat-card-close {
  background: none; border: none; font-size: 1.6rem;
  color: var(--text-light); cursor: pointer; padding: 0 8px; line-height: 1;
}
.lt-chat-card-close:hover { color: var(--dark); }
.lt-chat-card-msgs {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--cream);
}
.lt-chat-bubble {
  max-width: 80%; padding: 10px 14px; border-radius: 14px;
  font-size: .9rem; line-height: 1.4; word-wrap: break-word;
  animation: ltSlideIn .25s ease;
}
@keyframes ltSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.lt-chat-bubble.admin {
  align-self: flex-end;
  background: var(--orange); color: white;
  border-bottom-right-radius: 4px;
}
.lt-chat-bubble.admin.broadcast {
  background: linear-gradient(135deg, #f97316, #c2410c);
  border: 1px solid #ea580c;
}
.lt-chat-bubble.visitor {
  align-self: flex-start;
  background: var(--white); color: var(--dark);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.lt-chat-bubble-time {
  font-size: .65rem; opacity: 0.6; margin-top: 3px;
}
.lt-chat-card-form {
  padding: 12px; display: flex; gap: 8px;
  border-top: 1px solid var(--border);
}
.lt-chat-card-form input {
  flex: 1; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); font-family: inherit; font-size: .9rem;
  outline: none; transition: border-color .2s;
}
.lt-chat-card-form input:focus { border-color: var(--orange); }
.lt-chat-card-form input:disabled { background: var(--cream); color: var(--text-light); }
.lt-chat-card-form button {
  padding: 0 22px; border: none; border-radius: 10px;
  background: var(--orange); color: white; font-weight: 600;
  font-family: inherit; cursor: pointer; font-size: 1.1rem;
}
.lt-chat-card-form button:hover { background: var(--orange-dark); }

/* Monitor */
.lt-monitor-header {
  display: flex; justify-content: space-between; align-items: center;
  margin: 16px 0; gap: 12px; flex-wrap: wrap;
}
.lt-monitor-status {
  display: flex; align-items: center; gap: 8px;
  font-size: .9rem; font-weight: 600;
}
.lt-status-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #ccc;
  display: inline-block;
}
.lt-status-dot.connecting { background: #fbbf24; animation: ltPulse 1s infinite; }
.lt-status-dot.online { background: var(--green); box-shadow: 0 0 8px rgba(16,185,129,.6); animation: ltPulse 2s infinite; }
.lt-status-dot.offline, .lt-status-dot.error { background: var(--red); }
@keyframes ltPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.lt-monitor-controls { display: flex; gap: 8px; align-items: center; }
.lt-filter {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; background: var(--white); font-size: .85rem;
}

.lt-monitor-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 16px;
}
.lt-mstat {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; text-align: center;
}
.lt-mstat-num { font-size: 1.8rem; font-weight: 800; color: var(--dark); line-height: 1; }
.lt-mstat-label { font-size: .75rem; color: var(--text-light); text-transform: uppercase; letter-spacing: .5px; margin-top: 6px; }

.lt-monitor-feed {
  display: flex; flex-direction: column; gap: 8px;
  max-height: calc(100vh - 380px); overflow-y: auto;
  padding: 4px;
}
.lt-click-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px; align-items: start;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  transition: border-color .2s;
}
.lt-click-card:hover { border-color: var(--orange); }
.lt-click-flag {
  font-size: 2rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  background: var(--cream); border-radius: 12px;
}
.lt-click-row1 {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin-bottom: 4px;
}
.lt-click-link { font-weight: 700; font-size: .95rem; }
.lt-click-time { font-size: .75rem; color: var(--text-light); white-space: nowrap; }
.lt-click-row2 {
  font-size: .85rem; color: var(--dark); margin-bottom: 6px;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline;
}
.lt-click-tz { font-size: .7rem; color: var(--text-light); }
.lt-click-row3 { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.lt-click-row4 {
  display: flex; gap: 8px; align-items: center;
  font-size: .75rem; color: var(--text-light);
}
.lt-click-row4 code {
  font-family: 'Menlo', 'Consolas', monospace;
  background: var(--cream); padding: 2px 6px; border-radius: 4px;
}
.lt-tag {
  background: var(--cream); color: var(--dark);
  font-size: .7rem; padding: 3px 8px; border-radius: 6px; font-weight: 600;
}
.lt-tag-isp { background: rgba(249,115,22,.12); color: var(--orange-dark); }
.lt-tag-soft {
  font-size: .7rem; color: var(--text-light); padding: 0 4px;
}

@keyframes ltFlash {
  0%   { background: rgba(249,115,22,.18); transform: translateY(-4px); }
  100% { background: var(--white); transform: translateY(0); }
}
.lt-flash { animation: ltFlash .8s ease-out; }

@media (max-width: 768px) {
  .lt-link-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .lt-link-target { max-width: 100%; }
  .lt-monitor-stats { grid-template-columns: 1fr 1fr; }
  .lt-monitor-feed { max-height: calc(100vh - 480px); }
  .lt-itype-grid { grid-template-columns: 1fr 1fr; }
  .lt-rmode-grid { grid-template-columns: 1fr; }
  .lt-live-card { grid-template-columns: 40px 1fr; }
  .lt-live-card .lt-live-chat-btn { grid-column: 1 / -1; }
  .lt-chat-card { height: 100vh; max-height: 100vh; border-radius: 0; }
}

/* ========== Plantillas / Productos ========== */
.modal.modal-wide { max-width: 720px; }
.modal-wide .form-group textarea {
  width: 100%; padding: 10px 13px; border: 2px solid var(--border);
  border-radius: 10px; font-size: 0.88rem; font-family: inherit;
  resize: vertical; transition: border-color 0.2s;
}
.modal-wide .form-group textarea:focus { outline: none; border-color: var(--orange); }

.filters-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filters-row select, .filters-row input {
  padding: 8px 12px; border: 2px solid var(--border); border-radius: 10px;
  font-size: 0.85rem; font-family: inherit; background: var(--white);
}
.filters-row select:focus, .filters-row input:focus { outline: none; border-color: var(--orange); }
.filters-spacer { flex: 1; }

.product-tags {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.tag {
  display: inline-block; padding: 3px 10px;
  background: #f5f5f5; color: #555; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
}
.tag-industry { background: rgba(249,115,22,0.12); color: var(--orange); }
.tag-tier { background: rgba(99,102,241,0.12); color: #4f46e5; }
.tag-price { background: rgba(16,185,129,0.12); color: #059669; }
.tag-product { background: rgba(168,85,247,0.12); color: #7e22ce; }

.status-pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; margin-left: 8px;
  vertical-align: middle; text-transform: uppercase; letter-spacing: 0.3px;
}
.status-active, .status-green { background: rgba(16,185,129,0.15); color: #059669; }
.status-draft { background: #f0f0f0; color: #666; }
.status-sold-out, .status-red { background: rgba(239,68,68,0.15); color: var(--red); }
.status-featured, .status-orange { background: rgba(249,115,22,0.15); color: var(--orange); }
.status-blue { background: rgba(59,130,246,0.15); color: #2563eb; }
.status-purple { background: rgba(168,85,247,0.15); color: #7e22ce; }

/* ========== Leads ========== */
.leads-funnel {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px;
  margin-bottom: 24px;
}
.funnel-card {
  background: var(--white); border: 2px solid var(--border); border-radius: 12px;
  padding: 14px; cursor: pointer; transition: all 0.2s;
  text-align: center;
}
.funnel-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.funnel-card.active { border-color: var(--orange); }
.funnel-value { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.funnel-label { font-size: 0.72rem; color: var(--text-light); margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.funnel-orange .funnel-value { color: var(--orange); }
.funnel-blue .funnel-value { color: #2563eb; }
.funnel-purple .funnel-value { color: #7e22ce; }
.funnel-green .funnel-value { color: #059669; }
.funnel-red .funnel-value { color: var(--red); }
.funnel-total .funnel-value { color: var(--dark); }

.leads-search {
  flex: 1; min-width: 240px; padding: 10px 14px;
  border: 2px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: 0.88rem;
}
.leads-search:focus { outline: none; border-color: var(--orange); }

.leads-list { display: flex; flex-direction: column; gap: 8px; }
.lead-row {
  display: grid; grid-template-columns: 1.2fr 1.5fr auto;
  gap: 16px; align-items: center;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 18px;
  cursor: pointer; transition: all 0.15s;
}
.lead-row:hover { border-color: var(--orange); transform: translateX(2px); }
.lead-name { font-weight: 700; font-size: 0.95rem; }
.lead-contact { font-size: 0.8rem; color: var(--text-light); margin-top: 2px; }
.lead-row-mid { display: flex; flex-wrap: wrap; gap: 6px; }
.lead-row-right { text-align: right; }
.lead-date { display: block; font-size: 0.72rem; color: var(--text-light); margin-top: 4px; }

/* Lead detail modal */
.lead-detail-meta {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; font-size: 0.82rem; color: var(--text-light);
}
.lead-detail-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 20px;
  background: var(--cream); padding: 16px; border-radius: 12px;
  margin-bottom: 16px; font-size: 0.85rem; line-height: 1.5;
}
.lead-detail-grid strong { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); font-weight: 700; }
.lead-detail-block { margin-bottom: 16px; }
.lead-detail-block strong { font-size: 0.85rem; }
.lead-detail-block label { display: block; margin-bottom: 6px; }
.lead-detail-block p {
  margin-top: 6px; padding: 12px; background: var(--cream);
  border-radius: 10px; font-size: 0.88rem; line-height: 1.6; white-space: pre-wrap;
}
.lead-detail-block textarea {
  width: 100%; padding: 10px 13px; border: 2px solid var(--border);
  border-radius: 10px; font-size: 0.88rem; font-family: inherit;
  resize: vertical;
}
.lead-detail-block textarea:focus { outline: none; border-color: var(--orange); }
.lead-detail-small { font-size: 0.72rem; color: var(--text-light); word-break: break-all; }

.status-selector { display: flex; flex-wrap: wrap; gap: 8px; }
.status-btn {
  padding: 8px 14px; border: 2px solid var(--border); border-radius: 10px;
  background: var(--white); cursor: pointer; font-family: inherit;
  font-size: 0.82rem; font-weight: 600; color: var(--text-light);
  transition: all 0.2s;
}
.status-btn:hover { border-color: var(--orange); color: var(--orange); }
.status-btn.active.status-orange { background: var(--orange); color: var(--white); border-color: var(--orange); }
.status-btn.active.status-blue { background: #2563eb; color: var(--white); border-color: #2563eb; }
.status-btn.active.status-purple { background: #7e22ce; color: var(--white); border-color: #7e22ce; }
.status-btn.active.status-green { background: #059669; color: var(--white); border-color: #059669; }
.status-btn.active.status-red { background: var(--red); color: var(--white); border-color: var(--red); }

.modal-actions-spacer { flex: 1; }
.modal-actions .btn-danger {
  flex: 0 0 auto; padding: 12px 18px;
}

/* Dashboard funnel + recent leads */
.stat-card.stat-orange .stat-value { color: var(--orange); }
.stat-card.stat-blue .stat-value { color: #2563eb; }
.stat-card.stat-purple .stat-value { color: #7e22ce; }
.stat-card.stat-green .stat-value { color: #059669; }
.stat-card.stat-red .stat-value { color: var(--red); }

.dash-recent-leads {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.dash-recent-leads h4 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-light); font-weight: 700; margin-bottom: 10px;
}
.dash-recent-row {
  display: grid; grid-template-columns: 1fr 1.5fr auto; gap: 12px;
  padding: 8px 0; font-size: 0.85rem; border-bottom: 1px dashed var(--border);
}
.dash-recent-row:last-child { border-bottom: none; }
.dash-recent-name { font-weight: 600; }
.dash-recent-info { color: var(--text-light); }
.dash-recent-date { color: var(--text-light); font-size: 0.78rem; white-space: nowrap; }
.dash-block-empty {
  margin-top: 12px; padding: 16px; background: var(--cream);
  border-radius: 10px; color: var(--text-light); font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 768px) {
  .leads-funnel { grid-template-columns: repeat(3, 1fr); }
  .lead-row { grid-template-columns: 1fr; gap: 8px; }
  .lead-row-right { text-align: left; }
  .lead-detail-grid { grid-template-columns: 1fr; }
  .dash-recent-row { grid-template-columns: 1fr; gap: 2px; }
}

/* ========== Conversion Funnel ========== */
.dash-block-meta {
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 500;
}

.conversion-funnel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.conv-step {
  position: relative;
  background: var(--cream);
  border-radius: 10px;
  padding: 12px 16px;
  overflow: hidden;
}

.conv-step-bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(249,115,22,0.18) 0%, rgba(249,115,22,0.08) 100%);
  border-radius: 10px;
  transition: width 0.6s ease;
}

.conv-step-label {
  position: relative;
  font-size: 0.88rem;
  color: var(--text);
}

.conv-step-label strong {
  color: var(--orange);
  font-weight: 700;
  margin-right: 6px;
  font-size: 1rem;
}

.conv-step-success .conv-step-bar {
  background: linear-gradient(90deg, rgba(16,185,129,0.2) 0%, rgba(16,185,129,0.08) 100%);
}

.conv-step-success .conv-step-label strong {
  color: #059669;
}

.conv-rates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.conv-rate {
  text-align: center;
  padding: 12px;
  background: var(--cream);
  border-radius: 10px;
}

.conv-rate-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.conv-rate-label {
  font-size: 0.7rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-top: 6px;
}

.conv-rate.conv-rate-final {
  background: linear-gradient(135deg, rgba(249,115,22,0.1) 0%, rgba(249,115,22,0.04) 100%);
  border: 1px solid rgba(249,115,22,0.2);
}

.conv-rate.conv-rate-final .conv-rate-value {
  color: var(--orange);
}

@media (max-width: 768px) {
  .conv-rates { grid-template-columns: 1fr; }
}

/* ========== Personalinks ========== */
.personalink-row { cursor: default; }
.personalink-row:hover { transform: none; }

.personalink-url {
  font-family: 'Space Mono', monospace;
  font-size: 0.78rem;
  color: var(--orange);
  word-break: break-all;
  margin-top: 4px;
}

.personalink-note {
  font-size: 0.78rem;
  color: var(--text-light);
  font-style: italic;
  margin-top: 4px;
}

.personalink-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.personalink-visits {
  font-size: 0.85rem;
  color: var(--text);
}

.personalink-visits strong {
  color: var(--orange);
  font-weight: 700;
}

.personalink-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

/* Tenants section: pending domain dot pulses while provisioning */
.dot-pulse {
  display: inline-block;
  animation: dot-pulse-anim 1.4s ease-in-out infinite;
}
@keyframes dot-pulse-anim {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

/* ===== Notifications bell + drawer ===== */
.btn-notif {
  position: relative;
  background: var(--cream);
  border: 1px solid #e2e8f0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--text-dark, #0f172a);
  transition: all 0.2s;
}
.btn-notif:hover { background: white; box-shadow: 0 2px 8px rgba(15,23,42,0.08); }
.btn-notif-floating {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 90;
  background: white;
  box-shadow: 0 2px 12px rgba(15,23,42,0.1);
}
.notif-icon { line-height: 1; }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #dc2626;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}
.notif-badge[hidden] { display: none !important; }

.notif-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.notif-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.notif-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 92vw;
  height: 100vh;
  background: white;
  border-left: 1px solid #e2e8f0;
  box-shadow: -8px 0 24px rgba(15,23,42,0.08);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
.notif-drawer.open { transform: translateX(0); }
.notif-drawer-head {
  padding: 18px 22px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.notif-drawer-head h3 { font-size: 1rem; font-weight: 700; color: #0f172a; }
.notif-drawer-actions { display: flex; align-items: center; gap: 8px; }
.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.notif-empty {
  padding: 48px 22px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
}
.notif-item {
  display: block;
  padding: 14px 22px;
  border-bottom: 1px solid #f1f5f9;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
  position: relative;
}
.notif-item:hover { background: #f8fafc; }
.notif-item.unread {
  background: #eff6ff;
}
.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 22px;
  width: 6px;
  height: 6px;
  background: #2563eb;
  border-radius: 50%;
}
.notif-item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.notif-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
}
.notif-time {
  font-size: 0.7rem;
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
}
.notif-body {
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.45;
}
.notif-item[data-severity="success"] .notif-title::before { content: '✓ '; color: #16a34a; }
.notif-item[data-severity="warn"] .notif-title::before    { content: '⚠ '; color: #d97706; }
.notif-item[data-severity="error"] .notif-title::before   { content: '✕ '; color: #dc2626; }

@media (max-width: 768px) {
  .btn-notif-floating { display: none; }
  .mobile-header .btn-notif { display: inline-flex; margin-left: auto; }
}
@media (min-width: 769px) {
  .mobile-header .btn-notif { display: none; }
}
