/* ===== CRONVIET THEME - Light & Modern ===== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --primary: #2563eb;
  --primary-light: #dbeafe;
  --primary-dark: #1d4ed8;
  --accent: #06b6d4;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --secondary: #6b7280;

  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --border-light: #f3f4f6;

  --text: #111827;
  --text-2: #374151;
  --text-muted: #6b7280;
  --text-placeholder: #9ca3af;

  --sidebar-w: 256px;
  --header-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
  --transition: 0.2s ease;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== LAYOUT ===== */
.cv-layout { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.cv-sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
}

.cv-sidebar::-webkit-scrollbar { width: 4px; }
.cv-sidebar::-webkit-scrollbar-track { background: transparent; }
.cv-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.cv-sidebar-logo {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.cv-sidebar-logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.cv-sidebar-logo-icon svg { color: white; width: 20px; height: 20px; }

.cv-sidebar-logo-text { font-weight: 800; font-size: 1.05rem; color: var(--text); letter-spacing: -0.02em; }
.cv-sidebar-logo-text span { color: var(--primary); }

.cv-sidebar-nav { padding: 12px 12px; flex: 1; }

.cv-nav-section { margin-bottom: 4px; }

.cv-nav-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-placeholder);
  padding: 8px 12px 4px;
}

.cv-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 1px;
  position: relative;
}

.cv-nav-link:hover {
  background: var(--bg);
  color: var(--primary);
}

.cv-nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.cv-nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.cv-nav-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.8; }
.cv-nav-link.active svg { opacity: 1; }

.cv-sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-light);
}

/* ===== MAIN CONTENT ===== */
.cv-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== HEADER / TOPBAR ===== */
.cv-topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0; z-index: 50;
}

.cv-topbar-left { flex: 1; display: flex; align-items: center; gap: 12px; }

.cv-mobile-toggle {
  display: none;
  width: 36px; height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-2);
}

.cv-page-title { font-weight: 700; font-size: 1rem; color: var(--text); }

.cv-topbar-right { display: flex; align-items: center; gap: 8px; }

.cv-topbar-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  position: relative;
  transition: all var(--transition);
  text-decoration: none;
}

.cv-topbar-btn:hover { background: var(--surface-2); }

.cv-topbar-btn svg { width: 17px; height: 17px; }

.cv-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: var(--danger);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}

.cv-user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  background: var(--surface);
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
  color: var(--text);
}

.cv-user-menu:hover { background: var(--surface-2); }

.cv-user-avatar {
  width: 28px; height: 28px;
  border-radius: 99px;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.cv-user-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.cv-user-role { font-size: 0.72rem; color: var(--text-muted); }

.cv-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all 0.15s ease;
  z-index: 200;
}

.cv-user-menu:hover .cv-dropdown,
.cv-user-menu:focus-within .cv-dropdown { opacity: 1; visibility: visible; transform: none; }

.cv-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
}

.cv-dropdown-item:hover { background: var(--bg); color: var(--text); }
.cv-dropdown-item.danger:hover { background: var(--danger-light); color: var(--danger); }
.cv-dropdown-divider { height: 1px; background: var(--border-light); margin: 4px 0; }
.cv-dropdown-item svg { width: 15px; height: 15px; }

/* ===== PAGE BODY ===== */
.cv-page-body { padding: 28px; flex: 1; }

/* ===== STATS CARDS ===== */
.cv-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.cv-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow var(--transition);
}

.cv-stat-card:hover { box-shadow: var(--shadow-md); }

.cv-stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}

.cv-stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.cv-stat-icon.green { background: var(--success-light); color: var(--success); }
.cv-stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.cv-stat-icon.red { background: var(--danger-light); color: var(--danger); }
.cv-stat-icon.cyan { background: #cffafe; color: #0891b2; }

.cv-stat-icon svg { width: 20px; height: 20px; }

.cv-stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.cv-stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text); letter-spacing: -0.03em; line-height: 1; }

/* ===== CARD ===== */
.cv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cv-card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cv-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cv-card-title svg { width: 18px; height: 18px; color: var(--primary); }

.cv-card-body { padding: 22px; }

/* ===== ALERT BANNER ===== */
.cv-alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.cv-alert-warning {
  background: var(--warning-light);
  border: 1px solid #fcd34d;
  color: #92400e;
}

.cv-alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.cv-alert ul { list-style: disc; padding-left: 16px; margin-top: 6px; }
.cv-alert li { margin-bottom: 4px; }

/* ===== FORM ===== */
.cv-form-group { margin-bottom: 18px; }

.cv-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 7px;
}

.cv-input,
.cv-select,
.cv-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}

.cv-input:focus,
.cv-select:focus,
.cv-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.cv-input::placeholder { color: var(--text-placeholder); }

.cv-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

.cv-textarea { min-height: 100px; resize: vertical; }

/* ===== BUTTONS ===== */
.cv-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.cv-btn svg { width: 16px; height: 16px; }

.cv-btn-primary { background: var(--primary); color: white; }
.cv-btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }

.cv-btn-outline {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-2);
}
.cv-btn-outline:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

.cv-btn-success { background: var(--success); color: white; }
.cv-btn-success:hover { background: #059669; }

.cv-btn-danger { background: var(--danger); color: white; }
.cv-btn-danger:hover { background: #dc2626; }

.cv-btn-warning { background: var(--warning); color: white; }
.cv-btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.cv-btn-xs { padding: 4px 10px; font-size: 0.75rem; }

.cv-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== TABLE ===== */
.cv-table-wrap { overflow-x: auto; }

.cv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.cv-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.cv-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-2);
  vertical-align: middle;
}

.cv-table tr:last-child td { border-bottom: none; }
.cv-table tr:hover td { background: var(--surface-2); }

/* ===== BADGES / STATUS ===== */
.cv-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

.cv-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 99px;
  background: currentColor;
  flex-shrink: 0;
}

.cv-status-active { background: var(--success-light); color: #065f46; }
.cv-status-paused { background: var(--warning-light); color: #92400e; }
.cv-status-expired { background: var(--danger-light); color: #991b1b; }
.cv-status-pending { background: #e0e7ff; color: #3730a3; }

/* ===== MONO TEXT (URLs) ===== */
.cv-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  background: var(--bg);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  color: var(--text-2);
  word-break: break-all;
  border: 1px solid var(--border);
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* ===== ACTION BUTTONS GROUP ===== */
.cv-actions { display: flex; gap: 6px; align-items: center; }

/* ===== EMPTY STATE ===== */
.cv-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.cv-empty-icon {
  width: 64px; height: 64px;
  background: var(--bg);
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-placeholder);
}

.cv-empty-icon svg { width: 30px; height: 30px; }
.cv-empty h3 { font-size: 1rem; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.cv-empty p { font-size: 0.875rem; }

/* ===== MODAL ===== */
.cv-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(17,24,39,0.4);
  backdrop-filter: blur(3px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; visibility: hidden;
  transition: all 0.2s ease;
}

.cv-modal-overlay.open { opacity: 1; visibility: visible; }

.cv-modal {
  background: var(--surface);
  border-radius: calc(var(--radius) * 1.2);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s ease;
}

.cv-modal-overlay.open .cv-modal { transform: none; }

.cv-modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text);
}

/* ===== NOTICE / INFO BOX ===== */
.cv-info-box {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-size: 0.875rem;
  color: #1e40af;
  line-height: 1.7;
}

.cv-info-box strong { font-weight: 700; }
.cv-info-box ul { padding-left: 18px; margin-top: 8px; }
.cv-info-box li { margin-bottom: 4px; }

/* ===== PRICE DISPLAY ===== */
.cv-price-display {
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.cv-price-label { font-size: 0.85rem; opacity: 0.85; }
.cv-price-value { font-size: 1.4rem; font-weight: 800; }

/* ===== GRID ===== */
.cv-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cv-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ===== BREADCRUMB ===== */
.cv-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.cv-breadcrumb a { color: var(--text-muted); text-decoration: none; }
.cv-breadcrumb a:hover { color: var(--primary); }
.cv-breadcrumb-sep { opacity: 0.5; }
.cv-breadcrumb-current { color: var(--text-2); font-weight: 500; }

/* ===== API CODE BLOCK ===== */
.cv-code-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-2);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.cv-copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.75rem; font-weight: 600;
  cursor: pointer; color: var(--text-muted);
  transition: all var(--transition);
  font-family: inherit;
}

.cv-copy-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ===== NAP BANK PAGE ===== */
.cv-bank-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  cursor: pointer;
  transition: all var(--transition);
}

.cv-bank-card:hover, .cv-bank-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ===== NOTIFICATION ===== */
.cv-toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.cv-toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: slideInRight 0.3s ease;
}

.cv-toast-icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.cv-toast-success .cv-toast-icon { color: var(--success); }
.cv-toast-error .cv-toast-icon { color: var(--danger); }
.cv-toast-warning .cv-toast-icon { color: var(--warning); }

.cv-toast-msg { font-size: 0.875rem; color: var(--text-2); flex: 1; }

@keyframes slideInRight {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ===== WELCOME HERO ===== */
.cv-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  overflow: hidden;
  position: relative;
}

.cv-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 240px; height: 240px;
  background: var(--primary-light);
  border-radius: 99px;
  opacity: 0.5;
}

.cv-hero-content { position: relative; z-index: 1; }
.cv-hero-greeting { font-size: 0.85rem; color: var(--primary); font-weight: 600; margin-bottom: 6px; }
.cv-hero-title { font-size: 1.5rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; margin-bottom: 6px; }
.cv-hero-sub { font-size: 0.875rem; color: var(--text-muted); }

.cv-hero-actions { display: flex; gap: 10px; margin-top: 16px; }

.cv-hero-illustration {
  flex-shrink: 0;
  position: relative; z-index: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .cv-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .cv-sidebar {
    transform: translateX(-100%);
    width: 256px;
  }

  .cv-sidebar.open { transform: none; }

  .cv-main { margin-left: 0; }

  .cv-mobile-toggle { display: flex; }

  .cv-topbar { padding: 0 16px; }

  .cv-page-body { padding: 16px; }

  .cv-stats-grid { grid-template-columns: repeat(2, 1fr); }

  .cv-grid-3 { grid-template-columns: 1fr; }
}

/* ===== SIDEBAR OVERLAY ===== */
.cv-sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99;
  display: none;
}

.cv-sidebar-overlay.open { display: block; }
