/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Lark Suite Light Theme Colors */
  --bg:       #F9FAFB; /* Main background */
  --bg2:      #FFFFFF; /* Sidebar / Card background */
  --bg3:      #F3F4F6; /* Hover / Secondary background */
  --card:     #FFFFFF; /* Card background */
  --border:   #E5E7EB; /* Borders */
  --accent:   #2563EB; /* Primary Blue Lark */
  --accent-hover: #1D4ED8;
  --accent2:  #00B8D9; /* Teal for secondary accents */
  --gold:     #F5A623;
  --green:    #34C759;
  --red:      #FF3B30;
  --text:     #1F2329; /* Primary text */
  --text2:    #6B7280; /* Secondary text */
  --text3:    #C0C4CC; /* Tertiary text */
  --radius:   12px;
  --sidebar:  240px;
  --shadow:   0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ========== SIDEBAR ========== */
.sidebar {
  width: var(--sidebar);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 8px rgba(0,0,0,0.02);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  height: 70px;
}

.nav-logo-img {
  max-width: 100%;
  max-height: 32px;
  object-fit: contain;
}

.sidebar-nav { flex: 1; min-height: 0; padding: 16px 12px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }

.nav-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px;
  border: none; background: transparent;
  color: #000; font-family: inherit; font-size: 14.5px; font-weight: 600;
  border-radius: 8px; cursor: pointer; width: 100%; text-align: left;
  transition: all 0.2s;
  position: relative;
  text-decoration: none;
}
.nav-btn:hover { background: var(--bg3); color: var(--text); }
.nav-btn.active { background: rgba(51, 112, 255, 0.1); color: var(--accent); font-weight: 700; }
.nav-btn.active::before {
  content: '';
  position: absolute; left: -12px; top: 15%; bottom: 15%;
  width: 4px; background: var(--accent);
  border-radius: 0 4px 4px 0;
}
.nav-icon { font-size: 18px; filter: grayscale(100%) opacity(1); transition: all 0.2s; }
.nav-btn:hover .nav-icon { filter: grayscale(0%) opacity(1); }
.nav-btn.active .nav-icon { filter: grayscale(0%) opacity(1); }

.badge {
  margin-left: auto;
  background: #FF5E5E;
  color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 9999px; padding: 2px 8px;
  min-width: 22px; text-align: center;
}

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.stats-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; gap: 16px;
}
.stat { flex: 1; text-align: center; }
.stat-val { display: block; font-size: 20px; font-weight: 700; color: var(--accent); }
.stat-lbl { font-size: 12px; color: var(--text2); font-weight: 500; }

/* ========== MAIN CONTENT ========== */
.main-content {
  margin-left: var(--sidebar);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

/* ========== TOPBAR ========== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex; align-items: center; gap: 16px;
  height: 70px;
}

.menu-toggle {
  display: none; border: none; background: var(--bg3);
  color: var(--text); font-size: 20px; padding: 8px 12px;
  border-radius: 8px; cursor: pointer;
}

.topbar-logo {
  display: none;
  align-items: center;
  margin-right: 8px;
}

.topbar-logo-img {
  max-height: 32px;
  object-fit: contain;
}

@media (max-width: 900px) {
  .topbar-logo { display: flex; }
}

.topbar-search {
  flex: 1; max-width: 480px;
  display: flex; align-items: center;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 0 14px; gap: 10px;
  transition: border-color 0.2s;
}
.topbar-search:focus-within { border-color: var(--accent); }
.search-icon { font-size: 16px; color: var(--text2); }
.topbar-search input {
  flex: 1; border: none; background: transparent;
  color: var(--text); font-family: inherit; font-size: 14px;
  padding: 10px 0; outline: none;
}
.topbar-search input::placeholder { color: var(--text3); }
.clear-btn { border: none; background: transparent; color: var(--text2); cursor: pointer; font-size: 14px; }
.clear-btn:hover { color: var(--text); }

.topbar-filters { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-filters select {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 13px;
  padding: 8px 12px; border-radius: 8px; cursor: pointer; outline: none;
}
.view-toggle {
  width: 36px; height: 36px;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--text2); border-radius: 8px; cursor: pointer;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.view-toggle.active, .view-toggle:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ========== VIEWS ========== */
.view { display: none; padding: 28px 28px; flex: 1; }
.view.active { display: block; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 12px; flex-wrap: wrap;
}
.section-header h1 { font-size: 22px; font-weight: 700; }
.result-count { color: var(--text2); font-size: 14px; }

/* ========== PRODUCT GRID ========== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.product-grid.list-mode {
  grid-template-columns: 1fr;
}

.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(37, 99, 235,0.2);
  border-color: rgba(37, 99, 235,0.4);
}
.product-card.in-combo { border-color: var(--green); }
.product-card.in-combo::after {
  content: '✓ Trong Combo';
  position: absolute; top: 10px; right: 10px;
  background: var(--green); color: #000;
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 9999px;
}

.card-image {
  width: 100%; aspect-ratio: 1;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.product-card:hover .card-image img { transform: scale(1.05); }
.card-image .no-img { font-size: 48px; opacity: 0.3; }

.card-body { padding: 14px; }
.card-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  line-height: 1.4; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-price { font-size: 15px; font-weight: 700; color: var(--gold); }
.card-price.free { color: var(--text2); font-size: 13px; }
.card-actions {
  display: flex; gap: 6px;
  padding: 0 14px 14px;
}
.btn-detail {
  flex: 1; padding: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); font-family: inherit; font-size: 12px;
  border-radius: 8px; cursor: pointer; transition: all 0.2s;
}
.btn-detail:hover { background: var(--bg2); color: var(--text); }
.btn-add-combo {
  flex: 1.5; padding: 8px;
  background: var(--accent);
  border: none; color: #fff; font-family: inherit; font-size: 12px; font-weight: 600;
  border-radius: 8px; cursor: pointer; transition: opacity 0.2s;
}
.btn-add-combo:hover { opacity: 0.85; }
.btn-add-combo.added { background: var(--green); }

/* Inline qty control on product card */
.card-qty-ctrl {
  flex: 1.5;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid var(--green);
  border-radius: 8px; padding: 5px 8px;
  animation: fadeIn 0.2s ease;
}
.qty-btn {
  width: 24px; height: 24px;
  background: rgba(255,255,255,0.08); border: none;
  color: var(--text); border-radius: 6px; cursor: pointer;
  font-size: 15px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.qty-btn:hover { background: rgba(255,255,255,0.18); }
.qty-val {
  font-size: 14px; font-weight: 700; color: var(--green);
  min-width: 20px; text-align: center;
}
.qty-unit { font-size: 11px; color: var(--text2); }

/* LIST MODE */
.product-grid.list-mode .product-card {
  display: flex; flex-direction: row; align-items: stretch;
}
.product-grid.list-mode .card-image {
  width: 100px; flex-shrink: 0; aspect-ratio: 1;
}
.product-grid.list-mode .card-body { flex: 1; padding: 16px; }
.product-grid.list-mode .card-name { font-size: 14px; -webkit-line-clamp: 1; line-clamp: 1; }
.product-grid.list-mode .card-actions { flex-direction: column; padding: 12px; justify-content: center; min-width: 140px; }
.product-grid.list-mode .card-qty-ctrl { flex: none; width: 100%; }

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text2);
}
.empty-icon { font-size: 56px; margin-bottom: 16px; }

/* ========== MODAL ========== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: var(--bg);
  z-index: 200; align-items: flex-start; justify-content: center; padding: 0;
}
.modal-overlay.open { display: flex; }

.modal-overlay.popup-overlay {
  background: rgba(0,0,0,0.5);
  align-items: center;
  padding: 20px;
}

.modal {
  background: var(--bg2);
  border: none;
  border-radius: 0;
  width: 100%; height: 100vh;
  max-width: 100%; max-height: 100vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.22s ease;
}
.modal.modal-popup {
  height: auto;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
.modal-close {
  position: fixed; top: 20px; right: 24px;
  width: 42px; height: 42px;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--text); border-radius: 50%; cursor: pointer;
  font-size: 18px; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.modal-popup .modal-close {
  position: absolute;
  top: 16px; right: 16px;
  box-shadow: none;
}
.modal-close:hover { background: var(--red); border-color: var(--red); color: #fff; }

.modal-content { padding: 28px; max-width: 1200px; margin: 0 auto; }
.modal-top { display: flex; gap: 32px; margin-bottom: 24px; flex-wrap: wrap; }

/* ===== GALLERY ===== */
.modal-gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 420px;
  flex-shrink: 0;
}
.gallery-main {
  width: 420px;
  height: 420px;
  background: var(--bg3);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.gallery-main img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: opacity 0.18s ease;
}
.gallery-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,0.55);
  border: none; color: #fff;
  font-size: 28px; font-weight: 300;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 5;
}
.gallery-main:hover .gallery-nav { opacity: 1; }
.gallery-nav.prev { left: 6px; }
.gallery-nav.next { right: 6px; }
.gallery-nav:hover { background: rgba(37, 99, 235,0.8); }

/* Shopee-style thumbnail strip */
.gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.gallery-thumbs::-webkit-scrollbar { height: 4px; }
.gallery-thumbs::-webkit-scrollbar-track { background: transparent; }
.gallery-thumbs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.gallery-thumb {
  width: 54px; height: 54px;
  flex-shrink: 0;
  background: var(--bg3);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.15s;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb:hover { border-color: var(--accent2); transform: scale(1.06); }
.gallery-thumb.active { border-color: var(--accent); }

/* ===== MODAL NAME EDITING ===== */
.modal-info { flex: 1; min-width: 180px; }
.modal-name-wrap {
  display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 10px;
}
.modal-name { font-size: 20px; font-weight: 700; line-height: 1.3; flex: 1; }
.name-edit-btn {
  border: none; background: transparent;
  font-size: 16px; cursor: pointer;
  padding: 4px 6px; border-radius: 6px;
  color: var(--text2); transition: all 0.2s;
  flex-shrink: 0; margin-top: 2px;
}
.name-edit-btn:hover { background: var(--bg3); color: var(--accent); }

.modal-name-edit-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.modal-name-input {
  flex: 1; background: var(--bg3);
  border: 1.5px solid var(--accent);
  color: var(--text); font-family: inherit; font-size: 16px; font-weight: 600;
  padding: 9px 14px; border-radius: 8px; outline: none;
  min-width: 140px;
  transition: box-shadow 0.2s;
}
.modal-name-input:focus { box-shadow: 0 0 0 3px rgba(37, 99, 235,0.25); }
.save-name-btn {
  background: var(--green); color: #000; border: none;
  font-family: inherit; font-size: 13px; font-weight: 700;
  padding: 9px 16px; border-radius: 8px; cursor: pointer;
  white-space: nowrap; transition: opacity 0.2s;
}
.save-name-btn:hover { opacity: 0.85; }
.cancel-name-btn {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); font-family: inherit; font-size: 13px;
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
  transition: all 0.2s;
}
.cancel-name-btn:hover { color: var(--red); border-color: var(--red); }

.modal-price { font-size: 26px; font-weight: 800; color: var(--gold); margin-bottom: 16px; }
.modal-price.free { color: var(--text2); font-size: 16px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.modal-section { margin-top: 24px; }
.modal-section h3 {
  font-size: 14px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--accent2); margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.modal-desc {
  font-size: 14px; color: var(--text2); line-height: 1.7; white-space: pre-wrap;
  background: var(--bg3); border-radius: 8px; padding: 16px;
}
.no-desc {
  color: var(--text3); font-style: italic; font-size: 14px;
}

/* Edit desc */
.edit-desc-wrap { position: relative; }
.modal-desc-edit {
  width: 100%; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: inherit; font-size: 14px; line-height: 1.7;
  padding: 16px; resize: vertical; min-height: 120px; outline: none;
  transition: border-color 0.2s;
}
.modal-desc-edit:focus { border-color: var(--accent); }
.save-desc-btn {
  margin-top: 8px;
  background: var(--green); color: #000; border: none;
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 18px; border-radius: 8px; cursor: pointer;
}

/* Consulting notes */
.notes-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.note-item {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
}
.note-text { flex: 1; font-size: 14px; line-height: 1.6; color: var(--text2); white-space: pre-wrap; }
.note-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.note-action-btn {
  border: none; background: transparent; 
  cursor: pointer; font-size: 16px; padding: 2px 4px;
  transition: transform 0.2s;
}
.note-action-btn:hover { transform: scale(1.1); }
.note-action-btn.copy { color: var(--text); }
.note-action-btn.del { color: var(--red); }
.add-note-row { display: flex; gap: 8px; align-items: flex-end; }
.add-note-row textarea {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 14px;
  padding: 10px 14px; border-radius: 8px; resize: none; min-height: 80px; outline: none;
}
.add-note-row textarea:focus { border-color: var(--accent); }
.add-note-btn {
  background: var(--accent); color: #fff; border: none;
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 10px 16px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}

/* Image edit */
.img-edit-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.img-edit-row input[type=file] { display: none; }
.upload-img-btn {
  background: var(--bg3); border: 1px dashed var(--border);
  color: var(--text2); font-family: inherit; font-size: 13px;
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
}
.upload-img-btn:hover { border-color: var(--accent); color: var(--text); }

/* ========== COMBO VIEW ========== */
.combo-layout { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.combo-list { flex: 1; min-width: 300px; display: flex; flex-direction: column; gap: 10px; }

.combo-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  animation: fadeIn 0.3s ease;
}
.combo-item-img {
  width: 60px; height: 60px; border-radius: 8px;
  background: var(--bg3); overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.combo-item-img img { width: 100%; height: 100%; object-fit: cover; }
.combo-item-img .no-img { font-size: 24px; opacity: 0.4; }
.combo-item-info { flex: 1; min-width: 0; }
.combo-item-name { font-size: 13px; font-weight: 600; margin-bottom: 6px; }

/* Editable price row */
.combo-price-edit {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.price-label { font-size: 11px; color: var(--text2); white-space: nowrap; }
.price-input {
  width: 110px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 4px 8px; outline: none; transition: border-color 0.2s;
  -moz-appearance: textfield; appearance: textfield;
}
.price-input::-webkit-inner-spin-button,
.price-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.price-input:focus { border-color: var(--accent); }
.price-input.edited { border-color: var(--gold); color: var(--gold); }
.price-currency { font-size: 12px; color: var(--text2); }
.price-reset {
  border: none; background: transparent; color: var(--text2);
  cursor: pointer; font-size: 15px; padding: 2px 4px; line-height: 1;
  transition: color 0.2s;
}
.price-reset:hover { color: var(--gold); }
.combo-item-subtotal { font-size: 12px; color: var(--text2); }
.edited-tag { color: var(--gold); font-size: 10px; vertical-align: super; }

/* Discount badge in combo list */
.discount-badge {
  display: inline-flex; align-items: center;
  background: #e53935; color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 9999px;
  letter-spacing: 0.3px;
  animation: popIn 0.25s ease;
}
@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Original price crossed out */
.original-price-line {
  font-size: 11px; color: var(--text3);
  margin-top: 2px;
}
.original-price-line s { color: var(--text3); }

/* Discount badge in summary panel */
.summary-discount-badge {
  display: inline-flex; align-items: center;
  background: rgba(229,57,53,0.18); color: #ff6b6b;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 8px;
  border: 1px solid rgba(229,57,53,0.3);
  vertical-align: middle;
}
.combo-qty {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3); border-radius: 8px; padding: 6px 10px;
}
.combo-qty button {
  width: 24px; height: 24px; border: none; background: var(--bg2);
  color: var(--text); border-radius: 6px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.combo-qty span { font-weight: 600; min-width: 20px; text-align: center; }
.combo-remove {
  border: none; background: transparent;
  color: var(--red); cursor: pointer; font-size: 18px; padding: 4px;
}

.combo-summary { width: 300px; flex-shrink: 0; position: sticky; top: 90px; }
.summary-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.summary-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.summary-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.summary-row {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--text2);
}
.summary-row span:last-child { font-weight: 600; color: var(--text); }
.summary-total {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 15px; font-weight: 600; margin-bottom: 16px;
}
.total-price { font-size: 22px; font-weight: 800; color: var(--gold); }
.combo-name-row { margin-bottom: 12px; }
.combo-name-row input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 13px;
  padding: 10px 14px; border-radius: 8px; outline: none;
}
.combo-name-row input:focus { border-color: var(--accent); }

/* ========== FORM ========== */
.form-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 9999px; padding: 28px; max-width: 700px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 8px; }
.required { color: var(--red); }
.form-group input,
.form-group select,
.form-group textarea {
  min-height: 44px;
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 14px;
  padding: 12px 14px; border-radius: 8px; outline: none; transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; }

.image-upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px; text-align: center; cursor: pointer;
  transition: border-color 0.2s; min-height: 180px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg3);
}
.image-upload-area:hover { border-color: var(--accent); }
.upload-placeholder { color: var(--text2); }
.upload-icon { font-size: 40px; display: block; margin-bottom: 10px; }
.upload-hint { font-size: 12px; color: var(--text3); margin-top: 4px; }
#add-image-preview { max-width: 100%; max-height: 240px; border-radius: 8px; }

.form-actions { display: flex; gap: 12px; justify-content: flex-end; padding-top: 8px; }

/* ========== BUTTONS ========== */
.btn-primary {
  background: var(--accent);
  color: #fff; border: none; font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 12px 22px; border-radius: 8px; cursor: pointer; transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary.full-width { width: 100%; }
.btn-secondary {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 14px; font-weight: 500;
  padding: 12px 22px; border-radius: 8px; cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { background: var(--bg2); }

.combo-actions { display: flex; gap: 10px; }

/* ========== TOAST ========== */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 20px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow); z-index: 999;
  transform: translateY(20px); opacity: 0;
  transition: all 0.3s; pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }

/* ========== ANIMATIONS ========== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.product-card { animation: fadeIn 0.3s ease; }

/* ========== PRINT ========== */
@media print {
  body > *:not(#print-template) { display: none !important; }
  #print-template { display: block !important; }
  #print-content { padding: 20px; font-family: 'Inter', sans-serif; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .combo-summary { width: 100%; position: static; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .view { padding: 16px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .modal-top { flex-direction: column; }
  .modal-gallery { width: 100%; }
  .gallery-main { width: 100%; height: 280px; }
  .topbar { padding: 10px 14px; gap: 8px; }
}

/* ========== INVOICE VAT ========== */
.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
}
.invoice-items-table th {
  padding: 10px;
  background: var(--bg2);
  border-bottom: 2px solid var(--border);
  text-align: left;
  font-size: 13px;
  color: var(--text2);
}
.invoice-items-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.inv-input {
  width: 100%; background: var(--bg3); border: 1px solid transparent;
  color: var(--text); font-family: inherit; font-size: 13px;
  padding: 6px 8px; border-radius: 6px; outline: none; transition: border-color 0.2s;
}
.inv-input:focus { border-color: var(--accent); }
.inv-input-num {
  text-align: right;
}
.inv-row-del {
  background: transparent; border: none; color: var(--red); cursor: pointer; font-size: 16px;
}
.inv-row-del:hover { opacity: 0.8; }

/* ========== CREATIVE RESOURCE WAREHOUSE MODAL ========== */
.repo-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  overflow-x: auto;
}

.repo-tab-btn {
  background: transparent;
  border: none;
  color: var(--text2);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  position: relative;
}

.repo-tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.repo-tab-btn.active {
  color: var(--accent);
  background: rgba(37, 99, 235, 0.1);
}

.repo-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  box-shadow: 0 -2px 10px rgba(0, 229, 255, 0.6);
}

.repo-panels {
  background: var(--bg3);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  min-height: 250px;
  margin-top: 10px;
}

.repo-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.repo-panel.active {
  display: block;
}

/* --- Media Grids --- */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.repo-card {
  aspect-ratio: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.repo-card img,
.repo-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.repo-card .external-media-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
  gap: 6px;
  color: var(--text2);
  width: 100%;
  height: 100%;
}

.repo-card .external-media-icon {
  font-size: 28px;
}

.repo-card .external-media-name {
  font-size: 11px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.repo-card-actions {
  position: absolute;
  inset: 0;
  background: rgba(8, 7, 17, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 8px;
}

.repo-card:hover .repo-card-actions {
  opacity: 1;
  pointer-events: auto;
}

.repo-card-btn {
  width: 90%;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.15s;
}

.repo-card-btn:hover {
  transform: scale(1.04);
}

.repo-card-btn.copy-btn {
  background: var(--accent);
  color: #fff;
}

.repo-card-btn.copy-file-btn {
  background: var(--accent2);
  color: #000;
}

.repo-card-btn.view-btn {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}

.repo-card-btn.del-btn {
  background: var(--red);
  color: #fff;
}

/* --- Ads Content Styling --- */
.ads-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.ad-copy-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  position: relative;
  transition: border-color 0.2s;
}

.ad-copy-card:hover {
  border-color: rgba(37, 99, 235, 0.3);
}

.ad-copy-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  margin-bottom: 12px;
  font-family: inherit;
}

.ad-copy-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ad-copy-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ad-copy-btn.copy {
  background: var(--green);
  color: #000;
}

.ad-copy-btn.edit {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}

.ad-copy-btn.del {
  background: rgba(255, 82, 82, 0.15);
  color: var(--red);
  border: 1px solid rgba(255, 82, 82, 0.3);
}

.ad-copy-btn.del:hover {
  background: var(--red);
  color: #fff;
}

/* --- Adding creative resources wrapper --- */
.repo-add-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.repo-add-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: 8px;
}

.repo-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.repo-add-input {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  outline: none;
  min-width: 200px;
}

.repo-add-input:focus {
  border-color: var(--accent);
}

/* Form Product Creation Layout for Creative Material Store */
.repo-form-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}

.repo-form-box h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.repo-form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.repo-list-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.repo-item-preview {
  width: 70px;
  height: 70px;
  border-radius: 8px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.repo-item-preview img,
.repo-item-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.repo-item-preview .preview-icon {
  font-size: 20px;
}

.repo-item-preview-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: var(--red);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
  border: none;
}

.ad-copy-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.ad-copy-preview-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.ad-copy-preview-text {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 85%;
}

.ad-copy-preview-del {
  color: var(--red);
  font-size: 16px;
  background: transparent;
  border: none;
  cursor: pointer;
}

/* Lightbox full screen preview */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lightbox.open {
  display: flex;
  opacity: 1;
}

.lightbox-content {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 0 30px rgba(0,229,255,0.3);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 30px;
  color: #fff;
  background: transparent;
  border: none;
  cursor: pointer;
}

/* ========== PRODUCT SUB-TABS ========== */
.product-tabs-bar {
  display: flex;
  gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 6px;
  border-radius: 8px;
  margin-bottom: 20px;
  width: fit-content;
}

.prod-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.prod-tab-btn:hover {
  color: var(--text);
  background: var(--bg3);
}

.prod-tab-btn.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.prod-tab-btn .tab-icon {
  font-size: 15px;
}

/* Draggable Rows and Items Styling */
.draggable-row {
  cursor: grab;
  transition: background-color 0.2s ease;
}
.draggable-row:active {
  cursor: grabbing;
}
.draggable-row.dragging {
  opacity: 0.45;
  background: var(--bg2) !important;
}
.draggable-row.drag-over td {
  background: rgba(37, 99, 235, 0.15) !important;
  border-top: 2px solid var(--accent) !important;
  border-bottom: 2px solid var(--accent) !important;
}
.drag-handle {
  cursor: move;
  user-select: none;
  font-size: 16px;
  color: var(--accent);
}
.drag-handle:hover {
  color: var(--accent2);
}

.product-card {
  cursor: grab;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.product-card:active {
  cursor: grabbing;
}
.product-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}
.product-card.drag-over {
  border: 2px dashed var(--accent) !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Custom Tasks & Meetings Board Layout */
.tasks-board {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 16px;
}
@media (max-width: 1024px) {
  .tasks-board {
    grid-template-columns: 1fr;
  }
}
.board-column {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow);
}
.board-column-header {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent2);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.board-column-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.board-column-badge {
  background: var(--bg3);
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text2);
  font-weight: 600;
}
.board-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 550px;
  overflow-y: auto;
  padding-right: 4px;
}
.board-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s, border-color 0.2s;
  animation: fadeIn 0.3s ease;
  position: relative;
}
.board-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.board-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.board-item-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
}
.board-item-title.completed {
  text-decoration: line-through;
  color: var(--text3) !important;
  opacity: 0.6;
}
.board-item-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text2);
  align-items: center;
}
.board-item-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
.board-action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 3px 6px;
  border-radius: 4px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.board-action-btn:hover {
  background: rgba(255,255,255,0.05);
}
.board-action-btn.del {
  color: var(--red);
}
.board-action-btn.check {
  color: var(--green);
}
.board-action-btn.copy {
  color: var(--accent2);
}
.board-add-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 14px;
}
.board-add-form input,
.board-add-form select,
.board-add-form textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
}
.board-add-form input:focus,
.board-add-form select:focus,
.board-add-form textarea:focus {
  border-color: var(--accent);
}
.board-add-form button {
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
.priority-tag {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}
.priority-tag.cao {
  background: rgba(255, 82, 82, 0.15);
  color: #ff5252;
}
.priority-tag.trung-bình {
  background: rgba(255, 177, 0, 0.15);
  color: #ffb100;
}
.priority-tag.thấp {
  background: rgba(0, 230, 118, 0.15);
  color: #00e676;
}

/* ========== SEARCH HIGHLIGHT ========== */
mark.search-highlight {
  background-color: rgba(255, 179, 0, 0.3); /* a nice soft amber background */
  color: #ffb300; /* vibrant amber color */
  padding: 0 2px;
  border-radius: 4px;
  font-weight: bold;
}

/* ========== DELETE PRODUCT BUTTON STYLES ========== */
.btn-del-prod {
  transition: all 0.2s ease !important;
}
.btn-del-prod:hover {
  background-color: rgba(255, 82, 82, 0.15) !important;
  border-color: var(--red) !important;
  color: #fff !important;
}
.product-grid.list-mode .btn-del-prod {
  flex: 1 !important;
  width: 100%;
  margin-top: 4px;
}

/* ========== CONVERTER LAYOUT ========== */
.converter-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-top: 10px;
}

.converter-nav-card {
  width: 280px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.converter-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text2);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  width: 100%;
}

.converter-nav-item:hover:not(.disabled) {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border);
}

.converter-nav-item.active {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.3);
  color: #fff;
}

.converter-nav-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.converter-nav-item .tool-icon {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  transition: background 0.2s;
}

.converter-nav-item.active .tool-icon {
  background: var(--accent);
  color: #fff;
}

.converter-nav-item .tool-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.converter-nav-item .tool-name {
  font-size: 13px;
  font-weight: 600;
}

.converter-nav-item .tool-desc {
  font-size: 11px;
  color: var(--text3);
}

.converter-nav-item.active .tool-desc {
  color: var(--accent2);
}

.converter-work-area {
  flex: 1;
  min-width: 0;
}

.converter-tool-panel {
  display: none;
}

.converter-tool-panel.active {
  display: block;
}

/* ========== SPREADSHEET TABLE ========== */
.spreadsheet-table {
  background: var(--bg2);
  color: var(--text);
  width: 100%;
}

.spreadsheet-table th,
.spreadsheet-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  font-size: 13px;
  min-width: 80px;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

.spreadsheet-table th {
  background: var(--bg3);
  font-weight: 600;
  text-align: center;
  color: var(--text2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.spreadsheet-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.spreadsheet-table td input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 4px 6px;
  margin: -4px -6px;
  outline: none;
  border-radius: 4px;
}

.spreadsheet-table td input:focus {
  background: var(--bg3);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.spreadsheet-table .col-action-header {
  min-width: 40px;
  max-width: 40px;
  width: 40px;
  text-align: center;
}

.spreadsheet-table .row-action-cell {
  text-align: center;
  color: var(--red);
  cursor: pointer;
  font-size: 12px;
  width: 40px;
}

.spreadsheet-table .row-action-cell:hover {
  background: rgba(255, 82, 82, 0.1);
}

.spreadsheet-page-tab-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.spreadsheet-page-tab-btn:hover {
  background: var(--bg2);
  color: var(--text);
}

.spreadsheet-page-tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.spinner {
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--accent2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .converter-layout {
    flex-direction: column;
  }
  .converter-nav-card {
    width: 100%;
  }
}

/* ========== VISUAL PDF SPLIT WORKSPACE ========== */
.pdf-workspace-split {
  display: flex;
  gap: 20px;
  align-items: stretch;
  margin-top: 15px;
  flex-wrap: wrap;
  width: 100%;
}

.pdf-preview-left-card {
  max-width: 44%;
}

.pdf-preview-right-card {
  flex: 1.3;
}

@media (max-width: 1150px) {
  .pdf-workspace-split {
    flex-direction: column;
  }
  .pdf-preview-left-card {
    max-width: 100%;
    width: 100%;
  }
}

/* =========================================================================
   LOGIN SCREEN
   ========================================================================= */
.login-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.login-box {
  background: var(--surface);
  padding: 40px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  text-align: center;
  border: 1px solid var(--border);
}

.login-logo img {
  max-width: 150px;
  margin-bottom: 20px;
}

.login-box h2 {
  color: var(--text);
  margin-bottom: 25px;
  font-size: 24px;
}

.login-box .form-group {
  margin-bottom: 20px;
  text-align: left;
}

.login-box label {
  display: block;
  margin-bottom: 8px;
  color: var(--text2);
  font-size: 14px;
}

.login-box input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-size: 16px;
  transition: all 0.3s ease;
}

.login-box input:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 2px rgba(251,191,36,0.2);
}

/* ============================================================
   PREMIUM ADMIN DASHBOARD & USER MANAGEMENT STYLES
   ============================================================ */

/* Stats Grid & Cards */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.admin-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.admin-stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 4px; height: 100%;
}

.admin-stat-card.card-total::after { background: var(--accent); }
.admin-stat-card.card-admins::after { background: var(--gold); }
.admin-stat-card.card-users::after { background: var(--accent2); }

.admin-stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 16px 40px rgba(37, 99, 235, 0.15);
}

.admin-stat-icon {
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: var(--bg3);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.admin-stat-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-stat-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  font-family: 'Inter', sans-serif;
}

.admin-stat-lbl {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Two-column Layout Grid */
.admin-layout-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .admin-layout-grid {
    grid-template-columns: 1fr;
  }
}

.admin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  position: relative;
}

.admin-card-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.admin-card-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-card-header p {
  font-size: 13px;
  color: var(--text2);
  margin: 0;
}

.admin-card-header.flex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* Custom Styled Form Elements */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group-custom {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group-custom label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-group-custom .input-icon {
  font-size: 14px;
  opacity: 0.8;
}

.form-group-custom input,
.form-group-custom select {
  width: 100%;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  padding: 12px 16px;
  outline: none;
  transition: all 0.25s ease;
}

.form-group-custom input:hover,
.form-group-custom select:hover {
  border-color: rgba(37, 99, 235, 0.4);
}

.form-group-custom input:focus,
.form-group-custom select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25), 0 0 15px rgba(37, 99, 235, 0.15);
  background: var(--bg);
}

.btn-admin-submit {
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 14px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  margin-top: 10px;
  text-align: center;
}

.btn-admin-submit:hover {
  transform: translateY(-2px);
  opacity: 0.95;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* User List Table Design */
.btn-refresh-users {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-refresh-users:hover {
  background: var(--bg2);
  border-color: var(--accent2);
  color: var(--accent2);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}

.admin-table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg2);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  padding: 16px;
  background: var(--bg3);
  color: var(--text2);
  font-weight: 700;
  text-align: left;
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.8px;
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1.5px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr {
  transition: background 0.15s ease;
}

.admin-table tbody tr:hover {
  background: var(--bg3);
}

/* Role Badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge.admin {
  background: rgba(255, 214, 0, 0.1);
  color: var(--gold);
  border: 1px solid rgba(255, 214, 0, 0.3);
  box-shadow: 0 0 10px rgba(255, 214, 0, 0.1);
}

.role-badge.user {
  background: rgba(0, 229, 255, 0.08);
  color: var(--accent2);
  border: 1px solid rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.08);
}

/* Styled Delete Button */
.btn-delete-user-custom {
  background: rgba(255, 82, 82, 0.08);
  border: 1.5px solid rgba(255, 82, 82, 0.25);
  color: var(--red);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-delete-user-custom:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  box-shadow: 0 4px 14px rgba(255, 82, 82, 0.4);
  transform: translateY(-1px);
}

.btn-delete-user-custom:active {
  transform: translateY(0);
}





/* ========== INPUT INDICATORS ========== */
.form-group { position: relative; }
.input-indicators {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  display: flex;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  z-index: 5;
}
.form-group input, .form-group textarea, .form-group select {
  position: relative;
.form-group-custom .input-icon {
  font-size: 14px;
  opacity: 0.8;
}

.form-group-custom input,
.form-group-custom select {
  width: 100%;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  padding: 12px 16px;
  outline: none;
  transition: all 0.25s ease;
}

.form-group-custom input:hover,
.form-group-custom select:hover {
  border-color: rgba(37, 99, 235, 0.4);
}

.form-group-custom input:focus,
.form-group-custom select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25), 0 0 15px rgba(37, 99, 235, 0.15);
  background: var(--bg);
}

.btn-admin-submit {
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 14px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  margin-top: 10px;
  text-align: center;
}

.btn-admin-submit:hover {
  transform: translateY(-2px);
  opacity: 0.95;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* User List Table Design */
.btn-refresh-users {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-refresh-users:hover {
  background: var(--bg2);
  border-color: var(--accent2);
  color: var(--accent2);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}

.admin-table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg2);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  padding: 16px;
  background: var(--bg3);
  color: var(--text2);
  font-weight: 700;
  text-align: left;
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.8px;
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1.5px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr {
  transition: background 0.15s ease;
}

.admin-table tbody tr:hover {
  background: var(--bg3);
}

/* Role Badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge.admin {
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  box-shadow: none;
}

.role-badge.user {
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  box-shadow: none;
}

/* Styled Delete Button */
.btn-delete-user-custom {
  background: rgba(255, 82, 82, 0.08);
  border: 1.5px solid rgba(255, 82, 82, 0.25);
  color: var(--red);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-delete-user-custom:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  box-shadow: 0 4px 14px rgba(255, 82, 82, 0.4);
  transform: translateY(-1px);
}

.btn-delete-user-custom:active {
  transform: translateY(0);
}





/* ========== INPUT INDICATORS ========== */
.form-group { position: relative; }
.input-indicators {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  display: flex;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  z-index: 5;
}
.form-group input, .form-group textarea, .form-group select {
  position: relative;
}
  z-index: 2;
}
.ind-q, .ind-c, .ind-h { flex: 1; display: none; height: 100%; }
.ind-q { background-color: #3498db; }
.ind-c { background-color: #e74c3c; }
.ind-h { background-color: #f1c40f; }

.req-q .ind-q { display: block; }
.req-c .ind-c { display: block; }
.req-h .ind-h { display: block; }

/* Dynamic header inside topbar */
.topbar .section-header {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: none !important;
  width: 100%;
}
.topbar .section-header h1 {
  font-size: 16px !important;
  margin: 0 !important;
  font-weight: 700 !important;
}
/* Removed Safeguard for unstyled SVGs to prevent suneditor bug */
/* =========================================================
   BẢO VỆ GIAO DIỆN SUNEDITOR (Fix triệt để lỗi icon to đùng)
   ========================================================= */
.sun-editor .se-btn {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.sun-editor button > svg,
.sun-editor .se-svg {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    margin: auto !important;
    display: block !important;
    fill: currentColor !important;
}

.sun-editor .se-btn-select > svg,
.sun-editor .close > svg,
.sun-editor .se-dialog-close > svg {
    width: 10px !important;
    height: 10px !important;
    max-width: 10px !important;
    max-height: 10px !important;
}

.sun-editor .se-line-breaker > button > svg {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
}
/* ========================================================= */