@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  --primary: #4F46E5;
  /* Indigo-600 */
  --primary-glow: rgba(79, 70, 229, 0.1);
  --secondary: #6366F1;
  --bg-main: #F8FAFC;
  /* Slate-50 */
  --sidebar-bg: #FFFFFF;
  --text-main: #0F172A;
  /* Slate-900 */
  --text-muted: #64748B;
  /* Slate-500 */
  --border-light: #F1F5F9;
  --card-bg: #FFFFFF;
  --accent: #0284c7;
  /* Sky-600 */
  --input-bg: #F8FAFC;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --sidebar-width: 280px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --code-bg: #FFFFFF;
  --code-header: #F1F5F9;
  --code-text: #1E293B;
  --code-lines-bg: #F8FAFC;
  --code-lines-text: #94A3B8;
  --code-border: #E2E8F0;
}

:root[data-theme="dark"] {
  --bg-main: #0B1120;
  --sidebar-bg: #1E293B;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --border-light: #334155;
  --card-bg: #1E293B;
  --input-bg: #0F172A;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
  --code-bg: #020617;
  --code-header: #0F172A;
  --code-text: #E2E8F0;
  --code-lines-bg: rgba(255, 255, 255, 0.02);
  --code-lines-text: #64748B;
  --code-border: rgba(255, 255, 255, 0.05);
}

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .settings-container,
:root[data-theme="dark"] .editor-container,
:root[data-theme="dark"] .generator-panel,
:root[data-theme="dark"] .pricing-card,
:root[data-theme="dark"] .stat-card,
:root[data-theme="dark"] .admin-card,
:root[data-theme="dark"] .chat-card,
:root[data-theme="dark"] .chat-messages,
:root[data-theme="dark"] .category-btn,
:root[data-theme="dark"] .badge-cat,
:root[data-theme="dark"] .editor-panel,
:root[data-theme="dark"] .editor-content {
  background: var(--card-bg) !important;
  color: var(--text-main);
  border-color: var(--border-light) !important;
}

:root[data-theme="dark"] .sidebar {
  background: var(--sidebar-bg) !important;
  border-color: var(--border-light) !important;
}

:root[data-theme="dark"] .top-header {
  background: transparent !important;
  border-color: transparent !important;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: var(--input-bg) !important;
  color: var(--text-main) !important;
  border-color: var(--border-light) !important;
}

:root[data-theme="dark"] .form-group label,
:root[data-theme="dark"] .card-title,
:root[data-theme="dark"] .card-desc,
:root[data-theme="dark"] .toggle-label {
  color: var(--text-main) !important;
}

:root[data-theme="dark"] .chat-bubble.ai {
  background: var(--sidebar-bg) !important;
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

:root[data-theme="dark"] .chat-bubble.ai * {
  color: var(--text-main) !important;
}

:root[data-theme="dark"] .editor-toolbar,
:root[data-theme="dark"] .editor-header,
:root[data-theme="dark"] .editor-footer {
  background: var(--card-bg) !important;
  border-color: var(--border-light) !important;
}

:root[data-theme="dark"] .app-footer {
  background: #020617 !important;
  /* Deeper Slate for footer area */
  border-color: rgba(255, 255, 255, 0.05) !important;
}

:root[data-theme="dark"] .footer-nav a {
  color: #94A3B8 !important;
}

:root[data-theme="dark"] .footer-nav a:hover {
  color: white !important;
}

:root[data-theme="dark"] .footer-bottom {
  border-top-color: rgba(255, 255, 255, 0.05) !important;
  color: #475569 !important;
}

/* Ensure Logo handles change correctly in Footer too */
[data-theme="dark"] .app-footer .logo-light {
  display: none !important;
}

[data-theme="dark"] .app-footer .logo-dark {
  display: block !important;
}

:root[data-theme="dark"] .nav-link:hover,
:root[data-theme="dark"] .docs-item:hover,
:root[data-theme="dark"] .category-btn:hover {
  background: var(--bg-main) !important;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* View management */
.view {
  display: none !important;
}

.view.active {
  display: block !important;
}

/* App shell */
.app {
  display: flex;
  min-height: 100vh;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Auth Enforcement: Hide main app when in guest mode */
body.guest-mode .app {
  display: none !important;
}

body.guest-mode #auth-modal {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  background: var(--bg-main);
  /* solid background on guest mode */
}

body.guest-mode #close-auth-modal {
  display: none !important;
  /* Prevent closing on guest mode */
}

/* Sidebar Refinement */
.mobile-close-btn {
  display: none !important;
  /* Hidden on Desktop */
}

@media (max-width: 991px) {
  .mobile-close-btn {
    display: flex !important;
    /* Visible on Mobile/Tablet */
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 38px;
    height: 38px;
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    cursor: pointer;
    z-index: 101;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
  }

  .mobile-close-btn:hover {
    background: white;
    color: var(--primary);
  }

  .profile-info>div {
    flex-direction: column !important;
    gap: 1.5rem !important;
  }

  #btn-acc-upgrade {
    width: fit-content !important;
  }
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-light);
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.5rem;
  padding: 0 0.5rem;
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.logo-text {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.15rem;
  transition: var(--transition);
}

.nav-link i {
  width: 20px;
  height: 20px;
}

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

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

/* Sidebar Dropdown Sub-menu */
.nav-item-dropdown {
  margin-bottom: 0.375rem;
}

.nav-link .chevron {
  margin-left: auto;
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.nav-item-dropdown.active .chevron {
  transform: rotate(180deg);
}

.sub-menu {
  display: none;
  padding-left: 1.5rem;
  margin-top: 0.25rem;
  flex-direction: column;
}

.nav-item-dropdown.active .sub-menu {
  display: flex;
}

.sub-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.sub-nav-link i {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.sub-nav-link:hover {
  background: var(--bg-main);
  color: var(--text-main);
}

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

/* Admin Sidebar Extras */
.badge-count {
  background: #F59E0B;
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.375rem;
  border-radius: 6px;
  margin-left: auto;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.nav-item-dropdown .chevron {
  font-size: 0.75rem;
  opacity: 0.5;
}

.nav-item-dropdown.active .sub-menu {
  display: flex !important;
}

.admin-only {
  border-top: 1px solid var(--border-light);
  padding-top: 1.5rem !important;
  margin-top: 1.5rem !important;
}

/* Workbook Special Styles */
.icon-btn-square {
  width: 42px !important;
  height: 42px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 10px !important;
  flex-shrink: 0;
}

.icon-btn-square i {
  width: 18px;
  height: 18px;
}

.btn-danger {
  background: #EF4444 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2) !important;
  font-weight: 600;
  border: none !important;
}

.btn-danger:hover {
  background: #DC2626 !important;
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  min-width: 0;
  padding: 1.5rem 2.5rem 2rem;
  overflow-x: hidden;
}

/* Premium Header */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.header-left {
  flex-grow: 1;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.725rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.icon-btn {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

@media (min-width: 1025px) {

  #mobile-menu-toggle,
  .mobile-toggle-btn {
    display: none !important;
  }
}

.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-left: 1.25rem;
  border-left: 1px solid var(--border-light);
}

.avatar {
  background: linear-gradient(135deg, #6366F1, #A855F7);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
}

.search-box {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  width: 100%;
  max-width: 520px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-box input {
  border: none;
  outline: none;
  width: 100%;
  padding: 0.875rem 0;
  font-size: 0.9375rem;
  color: var(--text-main);
  background: transparent;
}

.tab {
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.tab.active {
  background: var(--text-main);
  color: var(--bg-main);
  border-color: var(--text-main);
}

/* Content Area */
.content-section {
  margin-top: 3rem;
}

.content-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.content-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Grid & Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.15rem;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: visible;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.card-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #f0f9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.card-star {
  color: var(--text-muted);
  transition: var(--transition);
}

.card-star:hover {
  color: var(--accent);
}

.card-title {
  font-weight: 700;
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
  padding-right: 2.25rem;
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: hidden;
}

/* Toggle Switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  width: 38px;
  height: 20px;
  background: #E2E8F0;
  border-radius: 100px;
  transition: var(--transition);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--card-bg);
  border-radius: 12px;
  top: 3px;
  left: 3px;
  transition: var(--transition);
}

#brand-toggle:checked+.toggle-switch {
  background: var(--primary);
}

#brand-toggle:checked+.toggle-switch::after {
  left: calc(100% - 17px);
}

.split-container {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.generator-panel {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  position: sticky;
  top: 1rem;
}

.editor-panel {
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.04);
  min-height: calc(100vh - 120px);

  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

/* Content Section */
.content-section {
  margin-top: 2rem;
}

.section-heading {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.section-subheading {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.category-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.category-divider::before {
  content: '';
  width: 4px;
  height: 20px;
  background: var(--primary);
  border-radius: 2px;
}

.category-divider-heading {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.01em;
}


/* Tabs row */
.tabs {
  margin-bottom: 2.25rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;

}

/* Cards Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 1.5rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 0;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.card-stat {
  background: #f0f7ff !important;
  /* Soft Glacier Blue */
  border: 1px solid #dbeafe !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.05) !important;
}

[data-theme="dark"] .card-stat {
  background: rgba(30, 41, 59, 0.4) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
}

.card-stat:hover {
  transform: translateY(-5px);
  background: #e0f2fe !important;
}

.card-stat:hover .card-icon {
  transform: scale(1.1);
  transition: transform 0.3s ease;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.125rem;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.card-star {
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  background: none;
  border: none;
  padding: 0;
}

.card-star:hover {
  color: var(--accent);
  transform: scale(1.15);
}

.card-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 0.625rem;
  line-height: 1.4;
}

.card-desc {
  font-size: 0.725rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: hidden;
  line-height: 1.6;
}

/* ── Generator / Editor Layout ──────────────────── */
.generator-panel-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border-light);
}

.gen-title-block h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
}

.gen-title-block p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.quota-badge {
  background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  border: 1px solid #C7D2FE;
}

/* Form elements */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  letter-spacing: 0.03em;
  text-transform: none;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  background: var(--input-bg);
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.form-group textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #94A3B8;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  background: var(--card-bg);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236366F1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 3rem;
  cursor: pointer;
}

/* Param grid */
.param-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Toggle Switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.5rem;
  cursor: pointer;
  user-select: none;
}

.toggle-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: #CBD5E1;
  border-radius: 100px;
  flex-shrink: 0;
  transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--card-bg);
  border-radius: 12px;
  top: 3px;
  left: 3px;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

#brand-toggle:checked+.toggle-switch {
  background: var(--primary);
}

#brand-toggle:checked+.toggle-switch::after {
  left: 21px;
}

/* Generate button */
.btn-hasikan-wrapper {
  padding-top: 1.25rem;
}

.btn-hasikan {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  padding: 0.9375rem;
  border-radius: 14px;
  border: none;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.02em;
  box-shadow: 0 6px 18px var(--primary-glow);
}

.btn-hasikan:hover {
  filter: brightness(1.1);
  box-shadow: 0 10px 25px var(--primary-glow);
  transform: translateY(-2px);
}

.btn-hasikan:active {
  transform: translateY(0);
}

.btn-hasikan:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Editor panel elements */
.editor-header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  border-radius: 20px 20px 0 0;
}

.editor-doc-name {
  border: 1px solid transparent;
  outline: none;
  font-family: 'Outfit', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  background: transparent;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  flex-grow: 1;
  max-width: 600px;
  transition: var(--transition);
}

.editor-doc-name:hover,
.editor-doc-name:focus {
  background: var(--input-bg);
  border-color: var(--border-light);
}

.editor-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.editor-toolbar {
  padding: 0.625rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;

  gap: 0.25rem;
  align-items: center;
  background: #FDFEFE;
}

.toolbar-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 0.725rem;
  font-weight: 600;
  line-height: 1;
}

.toolbar-btn:hover {
  background: #EEF2FF;
  color: var(--primary);
}

.toolbar-btn.active {
  background: #EEF2FF;
  color: var(--primary);
}

.toolbar-btn svg {
  width: 18px;
  height: 18px;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border-light);
  margin: 0 0.5rem;
}

.toolbar-select {
  font-family: 'Inter', sans-serif;
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-main);
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  background: var(--card-bg);
  outline: none;
  cursor: pointer;
}

.toolbar-ai-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.5rem 1rem;
  font-size: 0.725rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--primary-glow);
  transition: var(--transition);
}

.toolbar-ai-btn:hover {
  transform: scale(1.02);
  filter: brightness(1.1);
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 0.875rem 1rem;
  border-radius: 12px;
  border: 1.5px solid var(--border-light);
  background: var(--bg-main);
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.form-group textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.7;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #94A3B8;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  background: var(--card-bg);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236366F1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 3rem;
  cursor: pointer;
}

/* Param grid */
.param-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Toggle Switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.5rem;
  cursor: pointer;
  user-select: none;
}

.toggle-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: #CBD5E1;
  border-radius: 100px;
  flex-shrink: 0;
  transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--card-bg);
  border-radius: 12px;
  top: 3px;
  left: 3px;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

#brand-toggle:checked+.toggle-switch {
  background: var(--primary);
}

#brand-toggle:checked+.toggle-switch::after {
  left: 21px;
}

/* Generate button */
.btn-hasikan-wrapper {
  padding-top: 1.25rem;
}

.btn-hasikan {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  padding: 0.9375rem;
  border-radius: 14px;
  border: none;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.02em;
  box-shadow: 0 6px 18px var(--primary-glow);
}

.btn-hasikan:hover {
  filter: brightness(1.1);
  box-shadow: 0 10px 25px var(--primary-glow);
  transform: translateY(-2px);
}

.btn-hasikan:active {
  transform: translateY(0);
}

.btn-hasikan:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Editor panel elements */
.editor-header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  border-radius: 20px 20px 0 0;
}

.editor-doc-name {
  border: 1px solid transparent;
  outline: none;
  font-family: 'Outfit', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  background: transparent;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  flex-grow: 1;
  max-width: 600px;
  transition: var(--transition);
}

.editor-doc-name:hover,
.editor-doc-name:focus {
  background: var(--input-bg);
  border-color: var(--border-light);
}

.editor-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.editor-toolbar {
  padding: 0.625rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;

  gap: 0.25rem;
  align-items: center;
  background: #FDFEFE;
}

.toolbar-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 0.725rem;
  font-weight: 600;
  line-height: 1;
}

.toolbar-btn:hover {
  background: #EEF2FF;
  color: var(--primary);
}

.toolbar-btn.active {
  background: #EEF2FF;
  color: var(--primary);
}

.toolbar-btn svg {
  width: 18px;
  height: 18px;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border-light);
  margin: 0 0.5rem;
}

.toolbar-select {
  font-family: 'Inter', sans-serif;
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-main);
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  background: var(--card-bg);
  outline: none;
  cursor: pointer;
}

.toolbar-ai-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.5rem 1rem;
  font-size: 0.725rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--primary-glow);
  transition: var(--transition);
}

.toolbar-ai-btn:hover {
  transform: scale(1.02);
  filter: brightness(1.1);
}

.editor-content {
  flex-grow: 1;
  padding: 3.5rem 5rem;
  outline: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 600px;
  caret-color: var(--primary);
  background: var(--card-bg);
}

/* Rich text typography inside the editor */
.editor-content h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 1.25rem 0 0.5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-main) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.editor-content h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 1rem 0 0.4rem;
  line-height: 1.3;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.editor-content h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0.875rem 0 0.35rem;
  line-height: 1.4;
}

.editor-content h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0.875rem 0 0.5rem;
}

.editor-content p {
  margin: 0 0 0.75rem;
}

.editor-content strong {
  font-weight: 700;
  color: var(--text-main);
}

.editor-content em {
  font-style: italic;
  color: inherit;
  opacity: 0.9;
}

.editor-content ul {
  list-style: disc;
  padding-left: 2rem;
  margin: 0.5rem 0 1rem;
}

.editor-content ol {
  list-style: decimal;
  padding-left: 2rem;
  margin: 0.5rem 0 1rem;
}

.editor-content li {
  margin-bottom: 0.35rem;
  line-height: 1.5;
}

.editor-content blockquote {
  border-left: 5px solid var(--primary);
  background: var(--bg-main);
  margin: 2rem 0;
  padding: 1.25rem 2rem;
  color: var(--text-muted);
  font-style: italic;
  font-size: 1.125rem;
  border-radius: 0 12px 12px 0;
}

.editor-content blockquote p {
  margin: 0;
}

.editor-content hr {
  border: none;
  border-top: 2px solid var(--border-light);
  margin: 2.5rem 0;
}

.editor-content code {
  background: var(--bg-main);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-family: 'Fira Code', monospace;
  font-size: 0.9em;
  color: var(--primary);
  border: 1px solid var(--border-light);
}

.editor-content:empty::before {
  content: attr(placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

.editor-footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 0 0 20px 20px;
}

.editor-footer a {
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
}

/* Typing cursor */
.typing-cursor {
  border-right: 2px solid var(--primary);
  animation: blink 0.7s infinite;
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

/* Animations */
.fade-in {
  animation: fadeIn 0.35s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-left {
  animation: slideLeft 0.35s ease-out;
}

@keyframes slideLeft {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Shimmer loader */
.shimmer {
  background: linear-gradient(90deg, #f1f5f9 25%, #e8edf5 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmerMove 1.5s infinite;
  border-radius: 6px;
}

@keyframes shimmerMove {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* Sidebar nav sections */
.nav-section {
  margin-bottom: 1.25rem;
}

.nav-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #94A3B8;
  letter-spacing: 0.08em;
  padding: 0 0.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

.nav-links {
  list-style: none;
}

/* Documents View */
.doc-view-wrap {
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

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

.docs-table th {
  text-align: left;
  padding: 0.875rem 1.25rem;
  background: var(--input-bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-light);
}

.docs-table td {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.725rem;
}

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

.docs-table tr:hover td {
  background: var(--input-bg);
}

.docs-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.docs-empty-icon {
  width: 56px;
  height: 56px;
  background: var(--input-bg);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-main);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.badge.bg-writer {
  background: rgba(124, 58, 237, 0.1);
  color: var(--primary);
}

.badge.bg-code {
  background: rgba(14, 165, 233, 0.1);
  color: #0ea5e9;
}

/* delete button in table */
.btn-danger {
  color: #EF4444;
  border-color: #FCA5A5;
  background: #FFF5F5;
}

.btn-danger:hover {
  background: #FEE2E2;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-toggle-btn,
.mobile-close-btn {
  display: none;
}

.hide-mobile {
  display: flex;
}

/* Responsive Utilities */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    width: 72px;
    padding: 1rem 0.625rem;
    align-items: center;
  }

  .logo-text,
  .nav-title,
  .nav-link span {
    display: none;
  }

  .nav-link {
    justify-content: center;
  }

  .main-content {
    max-width: calc(100vw - 72px);
    padding: 1.5rem;
  }

  .split-container {
    grid-template-columns: 1fr;
  }

  /* Tablet Logo Optimization */
  .brand-logo {
    display: none !important;
  }

  .brand-favicon {
    display: block !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 10px;
  }

  .logo-container {
    padding: 0;
    justify-content: center;
    margin-bottom: 2rem;
  }

  /* Tablet Document Sub-menu (Icon only) */
  #docs-dropdown .chevron {
    display: none !important;
  }

  .sub-menu {
    display: none !important;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }

  #docs-dropdown.active .sub-menu {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    gap: 0.25rem;
  }

  .sub-nav-link {
    justify-content: center !important;
    padding: 0.875rem 0 !important;
    margin: 0 !important;
    width: 100%;
    border-radius: 12px !important;
  }

  .sub-nav-link span {
    display: none !important;
  }

  .sub-nav-link i {
    width: 20px !important;
    height: 20px !important;
    opacity: 1 !important;
    margin: 0 !important;
  }

  /* AI Code & Chat Tablet optimization */
  .code-container {
    flex-direction: column !important;
  }

  .code-sidebar-left {
    width: 100% !important;
    position: static !important;
  }

  /* Chat View Layout for Tablet (iPad Style) */
  .chat-layout {
    height: 85vh !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .hide-desktop {
    display: flex !important;
  }

  .chat-sidebar {
    position: fixed !important;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 500;
    width: 280px !important;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
  }

  .chat-sidebar.active {
    transform: translateX(0) !important;
  }

  .chat-content-area {
    flex: 1 !important;
    width: 100% !important;
  }
}

.hide-desktop {
  display: none !important;
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }

  .mobile-toggle-btn {
    display: flex;
    flex-shrink: 0;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    align-items: flex-start;
    padding: 1.5rem;
    background: var(--card-bg);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  /* Force visibility of text on mobile sidebar when open */
  .sidebar.active .logo-text,
  .sidebar.active .nav-title,
  .sidebar.active .nav-link span {
    display: inline !important;
  }

  .sidebar.active .nav-link {
    justify-content: flex-start !important;
    width: 100% !important;
  }

  .mobile-close-btn {
    display: flex;
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 10;
    background: var(--bg-main);
  }

  .main-content {
    max-width: 100vw;
    padding: 1rem;
  }

  .top-header {
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .search-box {
    padding: 0 0.75rem;
  }

  .header-right {
    gap: 0.5rem;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  /* Hide less important buttons on mobile to save space */
  .header-right .icon-btn[title="Layar penuh"],
  .header-right .icon-btn[title="Mode gelap"] {
    display: none;
  }

  .split-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .generator-panel {
    position: static;
    padding: 1.25rem;
  }

  .editor-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.25rem;
  }

  .editor-doc-name {
    max-width: 100%;
    width: 100%;
  }

  .editor-content {
    padding: 1.5rem;
  }

  .editor-toolbar {
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
    padding: 0.5rem 1rem;
    gap: 0.25rem;
    -webkit-overflow-scrolling: touch;
  }

  .editor-toolbar::-webkit-scrollbar {
    display: none;
  }

  .toolbar-btn {
    flex-shrink: 0;
  }

  .param-grid-2 {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .top-header {
    flex-wrap: wrap;

  }

  .header-left {
    order: 2;
    width: 100%;
  }

  .search-box {
    max-width: 100%;
  }

  .header-right {
    order: 1;
    margin-left: auto;
  }

  .mobile-toggle-btn {
    order: 0;
  }

  /* Compact Pricing on Mobile */
  .pricing-grid {
    gap: 1rem !important;
    padding: 0 0.5rem !important;
  }

  .pricing-card {
    padding: 1.25rem !important;
    border-radius: 18px !important;
  }

  .pricing-header {
    margin-bottom: 1rem !important;
  }

  .pricing-name {
    font-size: 0.8rem !important;
    margin-bottom: 0.25rem !important;
  }

  .pricing-price {
    font-size: 1.5rem !important;
  }

  .pricing-price .currency {
    font-size: 0.875rem !important;
  }

  .pricing-price .period {
    font-size: 0.75rem !important;
  }

  .pricing-features {
    margin: 0.5rem 0 1.25rem !important;
    padding-top: 0.5rem !important;
  }

  .pricing-features li {
    font-size: 0.8125rem !important;
    margin-bottom: 0.4rem !important;
    gap: 0.5rem !important;
  }

  .pricing-features i {
    width: 16px !important;
    height: 16px !important;
  }

  .pricing-badge {
    top: 1rem !important;
    right: 1.25rem !important;
    transform: none !important;
    font-size: 0.65rem !important;
    padding: 0.35rem 0.75rem !important;
    border-radius: 8px !important;
    background: var(--primary) !important;
    box-shadow: 0 4px 12px var(--primary-glow) !important;
  }

  .btn-block {
    padding: 0.625rem !important;
    font-size: 0.8125rem !important;
  }

  /* Compact AI Tool Cards on Mobile only */
  .card {
    padding: 1rem !important;
    display: grid !important;
    grid-template-columns: 36px 1fr 24px !important;
    grid-template-rows: auto auto !important;
    column-gap: 0.75rem !important;
    row-gap: 0.5rem !important;
    align-items: center !important;
  }

  .card-header {
    display: contents !important;
  }

  .card-icon {
    width: 36px !important;
    height: 36px !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    margin: 0 !important;
    border-radius: 8px !important;
  }

  .card-icon i {
    width: 18px !important;
    height: 18px !important;
  }

  .card-title {
    grid-column: 2 !important;
    grid-row: 1 !important;
    margin: 0 !important;
    font-size: 0.85rem !important;
    padding-right: 0 !important;
    line-height: 1.3 !important;
  }

  .btn-fav {
    grid-column: 3 !important;
    grid-row: 1 !important;
    width: 24px !important;
    height: 24px !important;
    margin: 0 !important;
  }

  .btn-fav i {
    width: 12px !important;
    height: 12px !important;
  }

  .card-desc {
    grid-column: 1 / span 3 !important;
    grid-row: 2 !important;
    margin-top: 0.25rem !important;
    font-size: 0.75rem !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
  }

  .badge-lock {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 16px !important;
    height: 16px !important;
    font-size: 10px !important;
    transform: translate(-4px, -4px) !important;
  }

  /* Compact AI Chat Personas on Mobile only */
  .chat-card {
    padding: 1rem !important;
    text-align: left !important;
    display: grid !important;
    grid-template-columns: 60px 1fr 24px !important;
    grid-template-rows: auto auto !important;
    column-gap: 1rem !important;
    row-gap: 0.5rem !important;
    align-items: center !important;
    border-radius: 20px !important;
  }

  .chat-avatar-wrap {
    width: 60px !important;
    height: 60px !important;
    margin: 0 !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
  }

  .chat-avatar {
    border-width: 2px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
  }

  .chat-card-title {
    grid-column: 2 !important;
    grid-row: 1 !important;
    margin: 0 !important;
    font-size: 0.95rem !important;
    text-align: left !important;
  }

  .chat-card .btn-fav {
    grid-column: 3 !important;
    grid-row: 1 !important;
    position: static !important;
    width: 24px !important;
    height: 24px !important;
    margin: 0 !important;
  }

  .chat-card-desc {
    grid-column: 1 / span 3 !important;
    grid-row: 2 !important;
    margin-top: 0.25rem !important;
    text-align: left !important;
    font-size: 0.75rem !important;
    line-height: 1.4 !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  /* Compact AI Code View on Mobile */
  #code-view .generator-panel {
    padding: 1rem !important;
  }

  #code-view .form-group {
    margin-bottom: 0.75rem !important;
  }

  #code-view label {
    font-size: 0.75rem !important;
    margin-bottom: 0.35rem !important;
  }

  #code-view #btn-generate-code {
    padding: 0.75rem !important;
    font-size: 0.8125rem !important;
    margin-top: 0.5rem !important;
  }

  #code-view .editor-header {
    padding: 0.75rem 1rem !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    border-radius: 16px 16px 0 0 !important;
  }

  #code-view .editor-doc-name {
    width: 100% !important;
    font-size: 0.95rem !important;
    padding: 0 0 0.5rem 0 !important;
    border-bottom: 1px solid var(--border-light) !important;
    border-radius: 0 !important;
    margin-bottom: 0.25rem !important;
  }

  #code-view .editor-header-actions {
    width: 100% !important;
    justify-content: space-between !important;
    gap: 0.25rem !important;
    overflow-x: auto !important;
    padding-bottom: 0.25rem !important;
  }

  #code-view .toolbar-select {
    min-width: 100px !important;
    max-width: 130px !important;
    font-size: 0.7rem !important;
    padding: 0.25rem 0.5rem !important;
  }

  #code-view .toolbar-btn {
    padding: 0.35rem !important;
    width: 32px !important;
    height: 32px !important;
  }

  /* --- AI Code Assistant Responsive (Smartphone & Tablet) --- */
  @media (max-width: 1024px) {
    #code-view .code-container {
      flex-direction: column !important;
      align-items: stretch !important;
      gap: 1.5rem !important;
      width: 100% !important;
      margin: 0 !important;
    }

    #code-view .code-sidebar-left {
      width: 100% !important;
      position: static !important;
      padding: 1.5rem !important;
      margin: 0 !important;
    }

    #code-view .code-editor-wrapper {
      width: 100% !important;
      flex: none !important;
      margin: 0 !important;
      border-radius: 0 !important;
    }

    #code-view .code-editor-wrapper .editor-header {
      flex-direction: column !important;
      align-items: stretch !important;
      padding: 1.25rem !important;
      gap: 1.25rem !important;
    }

    #code-view .editor-header-actions {
      width: 100% !important;
      justify-content: flex-start !important;
      flex-wrap: wrap !important;
      gap: 0.75rem !important;
    }

    #code-view .editor-doc-name {
      width: 100% !important;
      font-size: 1.1rem !important;
      margin-bottom: 0.25rem !important;
      border-bottom: 1px solid var(--border-light) !important;
      padding-bottom: 0.75rem !important;
    }

    #code-view #code-monaco-container {
      height: 500px !important;
      /* Slightly taller for tablets */
      width: 100% !important;
    }
  }

  /* Smartphone specific tweaks for Code View */
  @media (max-width: 600px) {
    #code-view #code-monaco-container {
      height: 420px !important;
      /* Shorter for phone screens */
    }

    #code-view .editor-header {
      padding: 1rem !important;
    }
  }

  /* Optimized Table Stack for Mobile (Premium Card Style) */
  .doc-view-wrap,
  .admin-table-wrap {
    overflow-x: visible !important;
    display: block !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .docs-table,
  .admin-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border: none !important;
  }

  .docs-table thead,
  .admin-table thead {
    display: none !important;
    /* Hide headers on mobile */
  }

  .docs-table tr,
  .admin-table tr,
  .admin-row {
    display: block !important;
    margin-bottom: 1.25rem !important;
    background: var(--card-bg);
    border-radius: 20px !important;
    border: 1px solid var(--border-light) !important;
    padding: 1.25rem !important;
    box-shadow: var(--shadow-md) !important;
    animation: fadeIn 0.3s ease;
  }

  .docs-table td,
  .admin-table td,
  .admin-row td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.875rem 0 !important;
    border-bottom: 1px solid #F1F5F9 !important;
    text-align: right !important;
    min-height: 44px;
    font-size: 0.8125rem !important;
    width: 100% !important;
    background: transparent !important;
  }

  .docs-table td:last-child,
  .admin-table td:last-child,
  .admin-row td:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-top: 1rem;
    justify-content: center !important;
  }

  .docs-table td::before,
  .admin-table td::before,
  .admin-row td::before {
    content: attr(data-label);
    font-weight: 800;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    flex-shrink: 0;
    margin-right: 1.5rem;
  }

  .table-actions {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    justify-content: center;
  }

  .btn-action-p {
    flex: 1;
    justify-content: center;
    border-radius: 12px !important;
    height: 42px;
  }

  /* Chat Layout Responsive */
  .chat-layout {
    flex-direction: column;
    height: calc(100vh - 140px);
  }

  .chat-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 400;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
    background: var(--sidebar-bg);
  }

  .chat-sidebar.active {
    transform: translateX(0);
  }

  .chat-content-area {
    width: 100%;
    flex-grow: 1;
  }

  /* Compact Admin Modals for Smartphone */
  .admin-edit-card,
  .modal-auth-content,
  .ai-modal-content {
    padding: 0 !important;
    max-height: 95vh;
    border-radius: 20px !important;
  }

  .admin-modal-header {
    padding: 1.25rem 1.5rem !important;
  }

  .modal-title {
    font-size: 1.25rem !important;
    margin-bottom: 0.125rem !important;
  }

  .modal-subtitle {
    font-size: 0.75rem !important;
    line-height: 1.3;
  }

  .admin-modal-body {
    padding: 1.25rem 1.5rem !important;
  }

  .admin-modal-footer {
    padding: 1rem 1.5rem !important;
  }

  .form-group {
    margin-bottom: 1rem !important;
  }

  .form-label {
    font-size: 0.7rem !important;
    margin-bottom: 0.4rem !important;
  }

  .form-input {
    padding: 0.7rem 1rem !important;
    font-size: 0.875rem !important;
    height: auto !important;
  }

  .grid-2-cols {
    grid-template-columns: 1fr !important;
    /* Stack columns */
    gap: 0.75rem !important;
  }

  .modal-close-btn {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
  }

  .auth-header {
    margin-bottom: 1.25rem !important;
  }

  .auth-header .logo-icon {
    width: 40px !important;
    height: 40px !important;
    margin-bottom: 1rem !important;
  }

  .auth-header .logo-icon i {
    width: 18px !important;
    height: 18px !important;
  }

  .auth-header h2 {
    font-size: 1.25rem !important;
  }

  .auth-tabs {
    margin-bottom: 1.25rem !important;
  }

  .auth-tab {
    padding: 0.625rem 1rem !important;
    font-size: 0.8125rem !important;
  }

  .chat-bubble {
    max-width: 95%;
    font-size: 0.8125rem;
  }

  /* Show Chat history toggle only on mobile */
  #btn-toggle-chat-sidebar {
    display: flex !important;
  }


  .main-content {
    padding: 1rem !important;
  }

  .dashboard-hero {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-content h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
  }

  .hero-content p {
    font-size: 0.725rem;
    margin-bottom: 1.5rem;
  }

  .hero-stats {
    gap: 1.25rem;
    margin-bottom: 1.5rem;
  }

  .stat-num {
    font-size: 1.25rem;
  }

  .hero-shortcuts {
    width: 100%;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .shortcut-btn {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    border-radius: 12px;
  }

  .top-header {
    margin-bottom: 1rem;
    flex-wrap: wrap;

  }

  .header-left {
    order: 2;
    width: 100%;
    margin-top: 0.5rem;
  }

  .header-right {
    gap: 0.5rem;
  }

  .user-profile {
    padding-left: 0.5rem;
    border: none;
  }

  .search-box input {
    padding: 0.6rem 0;
  }

  /* Split layout stacking */
  .split-container {
    grid-template-columns: 1fr !important;
  }

  .generator-panel {
    position: static;
    margin-bottom: 1.5rem;
  }

  .editor-header {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 1rem;
  }

  .editor-header-actions {
    justify-content: space-between;
  }

  .editor-toolbar {
    padding: 0.5rem;
    gap: 0.25rem;
  }

  .toolbar-select {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }

  .admin-stats-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ══════════════════ SAAS MEMBERSHIP & ADMIN ══════════════════ */

/* Pricing View - Modern Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  padding: 1.5rem 0 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 1024px) {
  .pricing-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .pricing-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Pricing Countdown Urgency Bar */
.pricing-timer-bar {
  margin: 0 auto 3.5rem auto;
  max-width: 820px;
  background: var(--card-bg);
  border: 1.5px solid rgba(245, 158, 11, 0.2);
  border-radius: 20px;
  padding: 1.25rem 2.5rem;
  box-shadow: 0 10px 35px -10px rgba(0,0,0,0.05);
  position: relative;
  overflow: hidden;
}

.pricing-timer-bar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 6px; height: 100%;
  background: linear-gradient(to bottom, #f59e0b, #d97706);
}

.timer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.timer-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  text-transform: uppercase;
}

.timer-text {
  font-weight: 800;
  color: var(--text-main);
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.timer-clock {
  font-family: 'Courier New', Courier, monospace;
  font-size: 2rem;
  font-weight: 900;
  color: #f59e0b;
  min-width: 160px;
  text-align: center;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
  animation: timerPulse 2s infinite ease-in-out;
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.03); }
}

@media (max-width: 768px) {
  .pricing-timer-bar { padding: 1.25rem; margin-bottom: 2.5rem; }
  .timer-content { gap: 1rem; flex-direction: column; }
  .timer-clock { font-size: 1.75rem; }
}

.pricing-card {
  background: var(--card-bg);
  border-radius: 28px;
  padding: 3rem 2.5rem;
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
}

.pricing-card:hover {
  transform: translateY(-12px);
  box-shadow: 0 30px 60px -15px rgba(79, 70, 229, 0.15);
  border-color: var(--primary-glow);
}

.pricing-card.popular {
  border: 2.5px solid var(--primary);
  box-shadow: 0 30px 60px -15px rgba(79, 70, 229, 0.2);
}

.pricing-badge {
  position: absolute;
  top: 1.5rem;
  right: -2.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.4rem 3.5rem;
  transform: rotate(45deg);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.pricing-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.pricing-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin: 0.75rem 0 0;
  color: var(--text-main);
}

.pricing-price .currency {
  font-size: 1.125rem;
  font-weight: 700;
  margin-right: 0.25rem;
  transform: translateY(-0.75rem);
}

.pricing-price .amount {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -2px;
}

.pricing-price .period {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 0.25rem;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1.5rem;
  flex-grow: 1;
  border-top: 1px solid var(--border-light);
  padding-top: 0.75rem;
}

.pricing-features li {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  font-size: 0.9375rem;
  color: var(--text-main);
  margin-bottom: 1.125rem;
  font-weight: 500;
}

.pricing-features i {
  background: #ECFDF5;
  color: #10B981;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  padding: 4px;
  font-size: 14px;
}

.pricing-features li.disabled {
  color: #94A3B8;
}

.pricing-features li.disabled i {
  background: var(--border-light);
  color: #94A3B8;
}

.btn-plan {
  width: 100%;
  padding: 1.125rem;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid var(--border-light);
  background: var(--card-bg);
  color: var(--text-main);
}

.pricing-card.popular .btn-plan {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 10px 20px var(--primary-glow);
}

.btn-plan:hover {
  background: var(--bg-main);
  border-color: var(--primary);
  color: var(--primary);
}

.pricing-card.popular .btn-plan:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  color: white;
}

/* Admin Dashboard Refinement */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 24px;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--primary-glow);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.logo-container {
  display: flex;
  align-items: center;
  margin-bottom: 2.5rem;
  padding: 0 0.5rem;
  min-height: 80px;
}

.brand-favicon {
  display: none;
}

/* Sidebar Logo - Desktop */
/* ══════════════════ SYSTEM BRANDING (SIDEBAR & FOOTER) ══════════════════ */

/* Sidebar Logo - Base */
.logo-container .brand-logo {
  height: 65px !important;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  transition: all 0.3s ease;
}

/* Theme Switching Logic for Sidebar Logo */
.logo-container .logo-light {
  display: block;
  mix-blend-mode: multiply;
  /* Removes white background from non-transparent logo */
}

.logo-container .logo-dark {
  display: none;
}

[data-theme="dark"] .logo-container .logo-light {
  display: none;
}

[data-theme="dark"] .logo-container .logo-dark {
  display: block;
  mix-blend-mode: screen;
  /* Removes black background from non-transparent logo-dk */
}

/* Footer Logo - Base */
.footer-logo .brand-logo {
  height: 32px !important;
  margin-bottom: 1rem;
}

/* Theme Switching Logic for Footer Logo */
.footer-logo .logo-light {
  display: block;
  mix-blend-mode: multiply;
}

.footer-logo .logo-dark {
  display: none;
}

[data-theme="dark"] .footer-logo .logo-light {
  display: none;
}

[data-theme="dark"] .footer-logo .logo-dark {
  display: block;
  mix-blend-mode: screen;
}

/* Favicon in Sidebar: Always visible */
.logo-container .brand-favicon {
  display: none;
  /* Hide favicon on desktop initially, might be used in tablet mode */
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.05);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.admin-table-wrap {
  background: var(--card-bg);
  border-radius: 20px;
  border: 1px solid var(--border-light);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

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

.admin-table th {
  background: var(--bg-main);
  padding: 0.85rem 1.25rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

.admin-table td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #F8FAFC;
  font-size: 0.875rem;
}

.admin-table tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .admin-table tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.plan-badge {
  padding: 0.375rem 1rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.doc-list-title {
  font-weight: 600;
  color: var(--text-main);
}

/* Modal Auth Overhaul */
.modal-auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.modal-auth-overlay.active {
  display: flex;
}

.modal-auth-content {
  background: rgba(255, 255, 255, 0.98);
  width: 100%;
  max-width: 440px;
  border-radius: 32px;
  padding: 3.5rem 3rem;
  box-shadow: 0 40px 100px -20px rgba(15, 23, 42, 0.25);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.3);
  animation: modalScaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    filter: blur(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

.auth-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.auth-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.auth-header p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.auth-tabs {
  display: flex;
  background: var(--border-light);
  padding: 0.375rem;
  border-radius: 16px;
  margin-bottom: 2rem;
  gap: 0.25rem;
}

.auth-tab {
  flex: 1;
  padding: 0.875rem;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s;
  background: transparent;
  color: var(--text-muted);
}

.auth-tab.active {
  background: var(--card-bg);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Profile Dropdown Menu */
.profile-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: var(--card-bg);
  min-width: 220px;
  border-radius: 18px;
  border: 1px solid var(--border-light);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.12);
  padding: 0.75rem;
  display: none;
  z-index: 1000;
  transform-origin: top right;
  animation: dropdownIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.profile-dropdown.active {
  display: block;
}

.profile-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
}

.profile-dropdown a:hover {
  background: var(--bg-main);
  color: var(--primary);
}

.profile-dropdown i {
  width: 16px;
  height: 16px;
}

.profile-dropdown hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 0.5rem 0;
}

.limit-banner {
  background: linear-gradient(135deg, #FFF1F2, #FFE4E6);
  border: 1px solid #FDA4AF;
  color: #E11D48;
  padding: 1.25rem 1.5rem;
  border-radius: 20px;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.1);
}

.card.locked {
  opacity: 1;
  position: relative;
}

.card.locked::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: grayscale(1) blur(2px);
  z-index: 2;
  border-radius: inherit;
}

.card.locked::after {
  content: '✦ Pro Tool';
  position: absolute;
  top: 1.25rem;
  right: 3.25rem;
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.25rem 0.625rem;
  border-radius: 100px;
  z-index: 3;
  box-shadow: 0 5px 15px var(--primary-glow);
  white-space: nowrap;
}


/* AI Chat & AI Code Enhancements */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  background: var(--card-bg);
  border-radius: 20px;
  border: 1px solid var(--border-light);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.chat-messages {
  flex-grow: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background-image: radial-gradient(#F1F5F9 1px, transparent 1px);
  background-size: 20px 20px;
}

.chat-bubble {
  max-width: 88%;
  padding: 1.125rem 1.75rem;
  border-radius: 24px;
  font-size: 0.875rem;
  line-height: 1.75;
  /* Perfect reading rhythm */
  position: relative;
  animation: fadeIn 0.3s ease-out;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-bubble.ai {
  align-self: flex-start;
  background: #F8FAFC;
  color: var(--text-main);
  border-bottom-left-radius: 4px;
  border: 1px solid #E2E8F0;
}

/* ── Rich text inside AI chat bubbles ─────────────────────────────────────── */
.chat-bubble.ai p {
  margin: 0 0 1.1em;
  /* Substantial gap between paragraphs */
  line-height: 1.75;
}

.chat-bubble.ai p:last-child {
  margin-bottom: 0;
}

.chat-bubble.ai h1,
.chat-bubble.ai h2,
.chat-bubble.ai h3,
.chat-bubble.ai h4 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--primary);
  margin: 1.5em 0 0.75em;
  line-height: 1.4;
}

.chat-bubble.ai h1 {
  font-size: 1.25rem;
}

.chat-bubble.ai h2 {
  font-size: 1.15rem;
}

.chat-bubble.ai h3 {
  font-size: 1.05rem;
}

.chat-bubble.ai h4 {
  font-size: 0.95rem;
}

.chat-bubble.ai ul,
.chat-bubble.ai ol {
  padding-left: 2.2rem;
  /* Enhanced indent for better structure */
  margin: 1rem 0 1.25rem;
}

.chat-bubble.ai li {
  margin-bottom: 0.85em;
  line-height: 1.75;
  padding-left: 0.5rem;
}

.chat-bubble.ai strong {
  font-weight: 700;
  color: var(--primary);
  /* Deep Indigo for keys */
}

.chat-bubble.ai em {
  font-style: italic;
}

.chat-bubble.ai code {
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.85em;
}

.chat-bubble.ai pre {
  background: #1E293B;
  color: #E2E8F0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin: 0.5rem 0;
  overflow-x: auto;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.725rem;
  line-height: 1.5;
}

.chat-bubble.ai pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}


.chat-bubble.ai blockquote {
  margin: 0.5em 0;
  padding: 0.5em 1em;
  border-left: 3px solid var(--primary);
  background: rgba(79, 70, 229, 0.05);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  font-style: italic;
}

.chat-bubble.ai hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 0.75em 0;
}


.chat-input-area {
  padding: 1.25rem 1.5rem;
  background: var(--card-bg);
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.chat-input-area textarea {
  flex-grow: 1;
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  resize: none;
  max-height: 150px;
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
  background: var(--bg-main);
}

.chat-input-area textarea:focus {
  border-color: var(--primary);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Chat character cards */
.chat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 28px;
  padding: 2.5rem 2rem;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.chat-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 50px -12px rgba(79, 70, 229, 0.15), 0 0 0 1px var(--primary-glow);
  border-color: var(--primary);
}

.chat-card.featured {
  background: #FFFDF5;
  border-color: #FDE68A;
}

.chat-avatar-wrap {
  position: relative;
  width: 124px;
  height: 124px;
  margin-bottom: 2rem;
}

.chat-avatar {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
  border: 4px solid white;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.chat-card-star {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  color: #FBBF24;
}

.chat-card-title {
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--text-main);
  margin-bottom: 0.625rem;
}

.chat-card-desc {
  font-size: 0.725rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.btn-chat-now {
  margin-top: auto;
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--bg-main);
  border: 1.5px solid var(--border-light);
  border-radius: 50%;
  color: var(--primary);
  font-weight: 400;
  font-size: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.chat-card:hover .btn-chat-now {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 10px 20px -5px var(--primary-glow);
  transform: translateY(-2px);
}

.btn-chat-now i {
  transition: transform 0.3s ease;
}

.chat-card:hover .btn-chat-now i {
  transform: translateX(4px);
}

/* ══════════════════ PRINT OPTIMIZATION ══════════════════ */
@media print {

  /* Basic Reset */
  body,
  html {
    background: var(--card-bg) !important;
    color: black !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Hide ALL UI elements */
  .sidebar,
  .top-header,
  .generator-panel,
  .editor-header,
  .editor-toolbar,
  .editor-footer,
  .editor-breadcrumb,
  .modal-auth-overlay,
  .sidebar-overlay,
  .pricing-container,
  .admin-stats-grid,
  .admin-table-wrap,
  .doc-view-wrap,
  .tabs,
  .section-heading,
  .section-subheading,
  footer,
  .breadcrumb,
  #btn-generate-ai,
  #btn-open-auth,
  .search-box,
  .quota-badge,
  .limit-banner,
  .auth-tabs,
  .auth-header,
  .btn-hasikan-wrapper,
  .mobile-toggle-btn,
  #mobile-menu-toggle {
    display: none !important;
  }

  /* Hide all views except the active generator view if we are printing results */
  #grid-view,
  #pricing-view,
  #admin-view,
  #documents-view {
    display: none !important;
  }

  /* Reset layout for full page width */
  .main-content {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    display: block !important;
    background: var(--card-bg) !important;
  }

  .view-container {
    padding: 0 !important;
    margin: 0 !important;
  }

  .split-container {
    display: block !important;
    gap: 0 !important;
  }

  .editor-panel {
    width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    background: var(--card-bg) !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }

  .editor-content {
    padding: 0.5in 0.5in !important;
    font-size: 11pt !important;
    line-height: 1.6 !important;
    color: black !important;
    background: transparent !important;
    overflow: visible !important;
    border: none !important;
  }

  .editor-content:empty::before {
    display: none !important;
  }

  /* Page breaks for clean layout */
  .editor-content p,
  .editor-content h1,
  .editor-content h2,
  .editor-content h3 {
    page-break-inside: avoid;
    margin-bottom: 1rem !important;
  }
}

/* ── AI Assistant Dropdown ────────────────────────────────────────────────── */
.ai-assistant-wrapper {
  position: relative;
  display: inline-block;
}

.ai-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  width: 220px;
  z-index: 1000;
  padding: 0.5rem;
  display: none;
  animation: fadeInDown 0.2s ease-out;
}

.ai-dropdown-menu.active {
  display: block;
}

.ai-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.725rem;
  color: var(--text-main);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ai-menu-item:hover {
  background: var(--bg-main);
  color: var(--primary);
  transform: translateX(4px);
}

.ai-menu-item i {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.ai-menu-item:hover i {
  color: var(--primary);
}

.ai-menu-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0.4rem 0.5rem;
}

/* ── AI Assistant Modal ───────────────────────────────────────────────────── */
.ai-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.ai-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.ai-modal-content {
  background: var(--card-bg);
  width: 90%;
  max-width: 480px;
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.9);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ai-modal-overlay.active .ai-modal-content {
  transform: scale(1);
}

.ai-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.ai-modal-title {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-main);
}

.ai-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.ai-modal-close:hover {
  background: var(--bg-main);
  color: var(--text-main);
}

.ai-modal-body textarea {
  width: 100%;
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  padding: 1rem;
  font-family: inherit;
  font-size: 0.9375rem;
  resize: none;
  outline: none;
  transition: all 0.2s ease;
  margin-bottom: 1.5rem;
  background: var(--bg-main);
}

.ai-modal-body textarea:focus {
  border-color: var(--primary);
  background: var(--card-bg);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.ai-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn-ai-cancel {
  padding: 0.625rem 1.25rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  background: var(--border-light);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ai-apply {
  padding: 0.625rem 1.25rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  background: var(--primary);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.btn-ai-cancel:hover {
  background: #E2E8F0;
}

.btn-ai-apply:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── AI Code View Enhancement ────────────────────────────────────────────── */
.code-container {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  min-height: 600px;
}

.code-editor-wrapper {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.editor-header {
  padding: 1rem 1.5rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.editor-doc-name {
  background: transparent;
  border: none;
  font-weight: 700;
  color: var(--text-main);
  font-size: 1.125rem;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  width: auto;
  transition: all 0.3s;
}

.editor-doc-name:focus {
  background: rgba(255, 255, 255, 0.7);
  outline: none;
}

.editor-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.code-editor-main {
  flex: 1;
  min-height: 500px;
  background: var(--code-bg);
}

#code-monaco-container {
  width: 100%;
  height: 600px;
}

.code-sidebar-left {
  width: 380px;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 1.5rem;
}

.code-sidebar-left .form-group {
  margin: 0;
}

#code-instruction {
  width: 100% !important;
  background: var(--bg-soft);
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  padding: 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  resize: none;
  transition: all 0.3s;
  color: var(--text-main);
}

#code-instruction:focus {
  border-color: var(--primary);
  background: var(--card-bg);
  box-shadow: 0 0 0 4px var(--primary-glow);
  outline: none;
}

.code-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.3s;
  cursor: pointer;
}

.code-action-btn.primary {
  background: var(--primary);
  color: white;
  border: none;
}

.code-action-btn.primary:hover {
  background: #4338ca;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -6px var(--primary);
}

.code-action-btn.outline {
  background: white;
  color: var(--text-main);
  border: 1.5px solid var(--border-light);
}

.code-action-btn.outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
}

/* Monaco Customization */
.monaco-editor {
  padding-top: 8px;
}

.toolbar-select {
  background: var(--bg-soft);
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.3s;
}

.toolbar-select:hover {
  border-color: var(--primary);
}

.toolbar-btn {
  background: white;
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s;
}

.toolbar-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border-light);
  margin: 0 0.25rem;
}

/* ── Account Dashboard Styles ───────────────────────────────────────────── */
.account-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}

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

.account-profile-card {
  position: relative;
  overflow: hidden;
  padding: 0 !important;
  border: none !important;
  background: var(--card-bg);
  box-shadow: var(--shadow-xl);
}

.profile-header-bg {
  height: 160px;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  position: relative;
  overflow: hidden;
}

.profile-header-bg::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 140%;
  height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.1) 0%, transparent 40%);
  filter: blur(40px);
}

.profile-content {
  padding: 0 2rem 2.5rem;
  margin-top: -60px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
  position: relative;
  z-index: 2;
}

.profile-avatar-large {
  width: 100px;
  height: 100px;
  border-radius: 24px;
  background: var(--card-bg);
  border: 4px solid white;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
}

.profile-info {
  padding-bottom: 0.5rem;
  width: 100%;
}

.profile-info h3 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.profile-info p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: 0.75rem;
}

.badge-row {
  display: flex;
  gap: 0.5rem;
}

.plan-badge {
  padding: 0.375rem 1rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bg-pro {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.bg-admin {
  background: rgba(16, 185, 129, 0.1);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.bg-free {
  background: var(--border-light);
  color: var(--text-muted);
  border: 1px solid #E2E8F0;
}

.card-header-simple {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.usage-stats-detailed {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.usage-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.usage-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.progress-bar-container {
  height: 10px;
  background: var(--border-light);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 100px;
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.order-history-wrap {
  margin: 0 -1.5rem -1.5rem;
  overflow-x: auto;
}

.order-status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-success {
  background: #ECFDF5;
  color: #10B981;
}

.status-pending {
  background: #FEF3C7;
  color: #D97706;
}

/* Code Highlighting & Advanced Editor Layout */
pre {
  background: #0f172a;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
  position: relative;
}

pre::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  z-index: 2;
}

code {
  font-family: 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;
  font-size: 0.725rem;
  line-height: 1.2;
  color: #e2e8f0;
  background: transparent;
  padding: 0;
}

/* Tokens - Refined for "Like Example" */
.token.comment {
  color: #859900;
  font-style: italic;
}

/* Green */
.token.keyword {
  color: #f92672;
  font-weight: 700;
}

/* Pink/Red */
.token.string {
  color: #ce9178;
}

/* Orange/Peach */
.token.function {
  color: #66d9ef;
}

/* Cyan/Blue */
.token.number {
  color: #fdf5a6;
}

/* Yellowish */
.token.operator {
  color: #f8f8f2;
}

.token.boolean {
  color: #ae81ff;
}

.token.variable {
  color: #a6e22e;
}

/* Light Green/Blue */
.token.class-name {
  color: #66d9ef;
}

/* In-text code */
p code {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.editor-content {
  line-height: 1.6;
}

/* Floating Copy Button */
.code-block-container {
  position: relative;
  border-radius: 12px;
}

.copy-code-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.copy-code-btn svg {
  width: 14px;
  height: 14px;
}

.copy-code-btn.copied {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border-color: #10b981;
}

.account-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
}


.code-header-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.725rem;
  font-weight: 600;
  transition: all 0.2s;
  border: 1.5px solid var(--border-light);
  background: var(--card-bg);
  color: var(--text-muted);
  cursor: pointer;
  height: 38px;
}

.code-header-btn i {
  width: 16px;
  height: 16px;
}

.code-header-btn:hover {
  background: var(--bg-main);
  color: var(--primary);
  border-color: var(--primary-glow);
}

.code-header-btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.code-header-btn.primary:hover {
  background: var(--secondary);
  border-color: var(--secondary);
  transform: translateY(-1px);
}

.code-header-btn.outline {
  background: transparent;
  border-color: var(--border-light);
}

.code-badge {
  padding: 0.25rem 0.625rem;
  background: rgba(255, 255, 255, 0.1);
  color: #94A3B8;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.code-window-controls {
  display: flex;
  gap: 6px;
  padding: 1rem 1.5rem;
  background: var(--code-header);
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--code-border);
  border-bottom: none;
}

.control-dot {
  width: 12px;
  height: 12px;
  border-radius: 12px;
}

.control-dot.red {
  background: #FF5F56;
}

.control-dot.yellow {
  background: #FFBD2E;
}

.control-dot.green {
  background: #27C93F;
}

/* ── Settings Page Styles ───────────────────────────────────────────── */
.settings-container {
  display: flex;
  gap: 2rem;
  background: var(--card-bg);
  border-radius: 24px;
  border: 1px solid var(--border-light);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  min-height: 500px;
}

.settings-sidebar {
  width: 260px;
  background: var(--bg-main);
  padding: 1.5rem;
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  border-radius: 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-tab:hover {
  background: #E2E8F0;
  color: var(--text-main);
}

.settings-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.settings-content {
  flex-grow: 1;
  padding: 2.5rem;
  position: relative;
}

.settings-pane {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-pane.active {
  display: block;
}

.settings-pane-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.375rem;
}

.settings-pane-desc {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 1.5rem 0;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  transition: border-color 0.2s ease;
}

.settings-row:hover {
  border-color: var(--primary-glow);
}

.settings-row h4 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.settings-row p {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin: 0;
}

.settings-select {
  padding: 0.625rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  font-family: inherit;
  font-size: 0.875rem;
  background: var(--bg-main);
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.settings-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: var(--card-bg);
}

/* Custom CSS Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--text-muted);
  transition: .3s;
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--card-bg);
  transition: .3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
  background-color: var(--primary);
}

input:focus+.slider {
  box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 12px;
}

@media (max-width: 768px) {
  .settings-container {
    display: flex;
    flex-direction: column;
  }

  .settings-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    flex-direction: row;
    overflow-x: auto;
    padding: 1rem;
  }

  .settings-tab {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .settings-row>div:last-child {
    align-self: flex-end;
  }
}

/* Animations Override */
.no-animations * {
  transition: none !important;
  animation: none !important;
}

/* Pagination Controls */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 1rem 0;
}

.pagination-btn {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-light);
  background: var(--card-bg);
  color: var(--text-main);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.725rem;
  font-weight: 500;
  transition: all 0.2s;
  min-width: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--bg-main);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.pagination-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Security Card */
.security-card {
  padding: 2rem;
  text-align: center;
  background: var(--card-bg);
  border-radius: 24px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
}

.security-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}

.security-badge {
  width: 60px;
  height: 60px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  border: 4px solid var(--card-bg);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

/* Dashboard Hero Section */
.dashboard-hero {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #c026d3 100%);
  padding: 3rem;
  border-radius: 28px;
  color: white;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 3rem;
  box-shadow: 0 25px 50px -12px rgba(79, 70, 229, 0.25);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.dashboard-hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  filter: blur(80px);
  pointer-events: none;
}

.hero-content h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hero-content p {
  font-size: 1.125rem;
  opacity: 0.85;
  margin-bottom: 2.5rem;
  max-width: 580px;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  gap: 2rem;
}

.hero-stat {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 1.5rem;
  font-weight: 800;
}

.stat-lbl {
  font-size: 0.75rem;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-shortcuts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.shortcut-btn {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  padding: 1.125rem 1.75rem;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  font-weight: 700;
  font-size: 0.9375rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.shortcut-btn:hover {
  background: white;
  color: var(--primary);
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.shortcut-btn i {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.shortcut-btn:hover i {
  transform: scale(1.1) rotate(5deg);
}

@media (max-width: 850px) {
  .dashboard-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-shortcuts {
    width: 100%;
  }
}

/* Admin Dropdown Styling */
.admin-select {
  padding: 0.5rem 0.875rem;
  border-radius: 10px;
  border: 1.5px solid var(--border-light);
  background: white;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.725rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  padding-right: 2.25rem;
  min-width: 140px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.admin-select:hover {
  border-color: var(--primary);
  background-color: var(--bg-main);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.admin-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
  border-color: var(--primary);
  background-color: white;
}

/* Badge Status */
.badge-status {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-status.pending {
  background: #FEF3C7;
  color: #D97706;
}

.badge-status.completed,
.badge-status.success {
  background: #D1FAE5;
  color: #059669;
}

.badge-status.failed,
.badge-status.cancelled {
  background: #FEE2E2;
  color: #DC2626;
}

/* Action Buttons in Tables */
.btn-action-edit,
.btn-action-delete {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.725rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  transition: var(--transition);
}

.btn-action-edit {
  color: var(--primary);
}

.btn-action-edit:hover {
  text-decoration: underline;
}

.btn-action-delete:hover {
  color: #DC2626;
}

.btn-action-delete:hover {
  text-decoration: underline;
}

.icon-btn-s {
  background: white;
  border: 1px solid var(--border-light);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.icon-btn-s:hover {
  background: var(--primary-glow);
  color: var(--primary);
  border-color: var(--primary);
}

/* Premium Action Pills */
.btn-action-p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.btn-action-p.primary {
  background: var(--primary-glow);
  color: var(--primary);
}

.btn-action-p.primary:hover {
  background: var(--primary);
  color: white;
}

.btn-action-p.danger {
  background: #FEF2F2;
  color: #EF4444;
}

.btn-action-p.danger:hover {
  background: #EF4444;
  color: white;
}

/* Admin UI Helpers */
.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

.admin-row td {
  padding: 1.25rem 1rem !important;
  vertical-align: middle;
}

.admin-table thead th {
  background: var(--bg-card);
  padding: 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.admin-tab-nav {
  margin-top: 1rem;
}

.admin-tab-link {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.875rem;
  padding-bottom: 0.75rem;
  position: relative;
  display: inline-block;
}

.admin-tab-link.active {
  color: var(--primary);
  font-weight: 700;
}

.admin-tab-link.active::after {
  content: '';
  position: absolute;
  bottom: -0.75rem;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary);
}

/* Authentication & AI Modals */
.modal-auth-overlay,
.ai-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-auth-overlay.active,
.ai-modal-overlay.active {
  display: flex !important;
  opacity: 1 !important;
}

.modal-auth-content,
.ai-modal-content {
  background: var(--card-bg);
  width: 100%;
  max-width: 440px;
  border-radius: 24px;
  padding: 2.5rem;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-auth-overlay.active .modal-auth-content,
.ai-modal-overlay.active .ai-modal-content {
  transform: translateY(0);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.auth-tabs {
  display: flex;
  background: var(--bg-main);
  padding: 0.375rem;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.auth-tab {
  flex: 1;
  padding: 0.625rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--card-bg);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* AI Assistant Modal specific tweaks */
.ai-modal-content {
  max-width: 600px;
}

.ai-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.ai-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.ai-modal-body textarea {
  width: 100%;
  padding: 1rem;
  background: var(--bg-main);
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  color: var(--text-main);
  font-family: inherit;
  resize: none;
  margin-bottom: 1.5rem;
  outline: none;
  transition: border-color 0.2s;
}

.ai-modal-body textarea:focus {
  border-color: var(--primary);
}

.ai-modal-footer {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.btn-ai-cancel {
  background: var(--bg-main);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ai-apply {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

/* Mobile Pricing Overrides */
@media (max-width: 600px) {
  .pricing-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }
}

.pricing-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.pricing-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary);
}

.pricing-card.featured {
  border: 2px solid var(--primary);
  box-shadow: 0 20px 40px var(--primary-glow);
}

.featured-badge {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: var(--primary);
  color: white;
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

.pricing-header {
  margin-bottom: 2rem;
}

.plan-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.plan-price {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 0.5rem;
}

.plan-price span {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}

.plan-features {
  list-style: none;
  flex-grow: 1;
  margin-bottom: 2.5rem;
}

.plan-features li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.9375rem;
  color: var(--text-main);
}

.plan-features li i[data-lucide="check"] {
  color: #10B981;
  width: 18px;
  height: 18px;
}

.plan-features li i[data-lucide="x"] {
  color: #EF4444;
  width: 18px;
  height: 18px;
}

.plan-features li.disabled {
  opacity: 0.5;
  text-decoration: line-through;
}

/* Administrative Edit Modals (Premium Design) */
.btn-range {
  padding: 0.35rem 0.85rem;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-range:hover {
  color: var(--primary);
  background: rgba(0, 0, 0, 0.03);
}

.btn-range.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .btn-range.active {
  background: rgba(255, 255, 255, 0.05);
}

.admin-edit-card {
  background: var(--card-bg);
  width: 100%;
  max-width: 760px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-color);
  animation: modalSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 40px 100px -20px rgba(15, 23, 42, 0.25);
}

.admin-modal-header {
  padding: 2rem 2.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.modal-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.admin-modal-body {
  padding: 2.5rem;
  overflow-y: auto;
  flex: 1;
}

.admin-modal-footer {
  padding: 1.5rem 2.5rem;
  background: var(--bg-main);
  border-top: 1px solid var(--border-color);
}

.modal-close-btn {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.modal-close-btn:hover {
  background: #EF4444;
  color: white;
  border-color: #EF4444;
  transform: rotate(90deg);
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(30px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.form-label {
  display: block;
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  text-transform: none;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100% !important;
  padding: 0.875rem 1.25rem !important;
  border-radius: 12px !important;
  border: 1px solid var(--border-color) !important;
  background: var(--bg-main) !important;
  color: var(--text-main) !important;
  font-size: 0.9375rem !important;
  transition: var(--transition) !important;
}

.form-input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px var(--primary-glow) !important;
  outline: none !important;
}

/* Premium Pagination */
.admin-pagination,
.docs-pagination,
.workbook-docs-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding: 1rem 0;
}

.btn-page,
.page-num {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  line-height: 1;
}

.btn-page:hover:not(:disabled),
.page-num:hover:not(:disabled) {
  background: var(--bg-main);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-page:disabled,
.page-num.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--border-light);
}

.btn-page.active,
.page-num.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0 1rem;
}

/* ── Chat ChatGPT-like Layout ───────────────────────────────────────── */
.chat-layout {
  display: flex;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  overflow: hidden;
  height: 85vh;
  margin-top: 1rem;
}

.chat-sidebar {
  width: 280px;
  background: var(--bg-main);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.btn-new-chat {
  width: 100%;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px dashed var(--primary);
  background: rgba(124, 58, 237, 0.05);
  color: var(--primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-new-chat:hover {
  background: var(--primary);
  color: white;
  border-style: solid;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.chat-history-list {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem;
}

.chat-history-item {
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.2rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  position: relative;
}

.chat-history-item:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-main);
}

.chat-history-item.active {
  background: var(--primary-glow);
  color: var(--primary);
  font-weight: 600;
}

.chat-history-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.btn-delete-chat {
  opacity: 0;
  color: var(--text-muted);
  transition: opacity 0.2s;
  padding: 0.25rem;
}

.chat-history-item:hover .btn-delete-chat {
  opacity: 1;
}

.btn-delete-chat:hover {
  color: #ef4444;
}

.chat-content-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background: white;
  width: 100%;
}

.chat-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-light);
  background: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 10;
}

.chat-actions {
  display: flex;
  gap: 0.5rem;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--primary);
}

.chat-input-area {
  padding: 1.5rem;
  background: white;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.chat-input-area textarea {
  flex-grow: 1;
  min-height: 56px;
  border: 1.5px solid var(--border-light);
  border-radius: 14px;
  padding: 0.65rem 0.85rem;
  resize: none;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
  background: var(--bg-main);
  line-height: 1.4;
}

.chat-input-area textarea:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.chat-bubble.ai {
  align-self: flex-start;
  background: #F8FAFC;
  color: var(--text-main);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-light);
}

/* --- Utilities --- */
.alert {
  padding: 1.25rem 1.5rem;
  border-radius: 16px;
  margin-bottom: 2rem;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9375rem;
  transition: var(--transition);
  animation: fadeIn 0.4s ease-out;
}

.alert-primary {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.08);
}

.alert i {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--primary-glow);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

.btn-outline {
  background: var(--card-bg);
  border-color: var(--border-light);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
}

.btn-block {
  width: 100%;
}

.bg-free {
  background: #64748B !important;
  color: white !important;
}

.bg-basic {
  background: #3B82F6 !important;
  color: white !important;
}

.bg-pro {
  background: linear-gradient(135deg, #4F46E5, #9333EA) !important;
  color: white !important;
}

.bg-unlimited {
  background: linear-gradient(135deg, #1E293B, #0F172A) !important;
  color: white !important;
}

.bg-admin {
  background: #F59E0B !important;
  color: white !important;
}

.bg-completed,
.bg-success {
  background: #10B981 !important;
  color: white !important;
}

.bg-pending {
  background: #F59E0B !important;
  color: white !important;
}

.bg-failed,
.bg-cancelled {
  background: #EF4444 !important;
  color: white !important;
}

/* --- User Favorite Buttons (Reverted Fixed) --- */
.btn-fav {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  width: auto;
  height: auto;
  background: transparent !important;
  border: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: none !important;
  opacity: 0.7;
}

.btn-fav:hover {
  transform: scale(1.2);
  color: #FBBF24;
  opacity: 1;
}

.btn-fav.active {
  color: #FBBF24;
  opacity: 1;
}

.btn-fav i {
  width: 22px !important;
  height: 22px !important;
  fill: none;
  stroke-width: 2.2;
}

.btn-fav.active i {
  fill: #FBBF24;
  filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.3));
}

.chat-card .btn-fav {
  top: 1.25rem;
  right: 1.25rem;
}

.btn-fav.active i {
  stroke: #FBBF24;
}

/* ── Academic Writing Guide View ── */
.guide-header {
  margin-bottom: 2rem;
  text-align: center;
  background: linear-gradient(135deg, var(--primary) 0%, #4338CA 100%);
  padding: 3rem 2rem;
  border-radius: 20px;
  color: white;
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.2);
}

.guide-mode-selector {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;

}

.guide-header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.guide-header p {
  opacity: 0.9;
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

.step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 3rem 2rem;
  margin-bottom: 4rem;
  padding: 1rem 0;
}

.step-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 2.5rem 2rem 2rem;
  position: relative;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.step-card:hover {
  transform: translateY(-8px);
  border-color: var(--primary);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05);
}

.step-number {
  position: absolute;
  top: -24px;
  left: 20px;
  background: var(--primary);
  color: white;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: 0 8px 15px rgba(79, 70, 229, 0.25);
  z-index: 2;
}

.step-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0.5rem 0 1rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.step-card p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 2rem;
  flex-grow: 1;
}

.step-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-guide {
  width: 100%;
  padding: 0.875rem;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  border: none;
  background: var(--primary);
  color: white;
}

.btn-guide.secondary {
  background: var(--bg-main);
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

.btn-guide:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.btn-guide.secondary:hover {
  background: white;
  border-color: var(--primary);
  color: var(--primary);
}

@media (max-width: 768px) {
  .guide-header {
    padding: 3rem 1.5rem;
  }

  .guide-header h1 {
    font-size: 1.75rem;
  }

  .step-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Refined Guide Components ── */
.guide-mode-content {
  display: none;
}

.guide-mode-content.active {
  display: block;
}

.step-card-tip {
  margin-top: auto;
  padding-top: 1.25rem;
  font-size: 0.75rem;
  color: var(--primary);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  border-top: 1px dashed var(--border-light);
  font-weight: 500;
  font-style: italic;
}

.step-card-tip i {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.step-outcome {
  display: flex;
  flex-wrap: wrap;

  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.outcome-badge {
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary);
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.guide-mode-selector {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.mode-tab {
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.mode-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.mode-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
  transform: translateY(-2px);
}

.guide-footer-info {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 2.5rem;
  margin-top: 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2.5rem;
}

.info-box h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.info-box p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.info-box ul {
  padding-left: 1.25rem;
  margin-top: 1rem;
}

.info-box li {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ── Modern Footer ── */
.app-footer {
  margin-top: 4rem;
  padding: 3rem 0 1.5rem;
  background: #F0F7FF;
  /* Light Pearl Blue - soft and clean */
  color: #64748B;
  /* Slate-500 */
  position: relative;
  z-index: 10;
  border-top: 1px solid #E2E8F0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  overflow: visible;

  gap: 2.5rem;
  max-width: 1240px;
  margin: 0 auto 2rem;
  padding: 0 2rem;
}

.footer-brand .brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  display: block;
  margin-bottom: 0.5rem;
}

.footer-brand p {
  color: #64748B;
  /* Slate-500 */
  font-size: 0.8125rem;
  max-width: 320px;
  line-height: 1.6;
}

.footer-nav {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;

}

.footer-nav a {
  color: #475569;
  /* Slate-600 */
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.2s ease;
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--primary);
}

.footer-nav a:hover {
  color: var(--primary);
  transform: translateY(-1px);
}

.footer-bottom {
  text-align: center;
  padding: 1.25rem 0 0;
  margin: 0 2rem;
  border-top: 1px solid #E2E8F0;
  color: #94A3B8;
  /* Slate-400 */
  font-size: 0.725rem;
}

/* Restored standard logo handling for light background */
/* (CSS below handles standard theme switching) */

.version-tag {
  opacity: 0.6;
  margin-left: 0.5rem;
  font-family: monospace;
}

@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  .footer-nav {
    justify-content: center;
    gap: 1.5rem;
  }
}

/* ── Legal Pages ── */
.legal-page {
  max-width: 850px;
  margin: 0 auto;
  background: var(--card-bg);
  padding: 5rem 4rem;
  border-radius: 28px;
  border: 1px solid var(--border-light);
  line-height: 1.8;
  box-shadow: var(--shadow-sm);
}

.legal-page h2 {
  margin-bottom: 2.5rem;
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-main);
  text-align: center;
  letter-spacing: -0.02em;
}

.legal-page section {
  margin-bottom: 1.5rem;
}

.legal-page h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.legal-page p,
.legal-page li {
  color: var(--text-muted);
  font-size: 1rem;
}

.legal-page ul {
  padding-left: 1.5rem;
  margin-top: 1rem;
}

.legal-page li {
  margin-bottom: 0.75rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.contact-info-card {
  padding: 1.5rem;
  background: var(--bg-main);
  border-radius: 16px;
  border: 1px solid var(--border-light);
  text-align: center;
}

.contact-info-card i {
  color: var(--primary);
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .legal-page {
    padding: 3rem 1.5rem;
    border-radius: 0;
    border: none;
  }
}

@media (max-width: 600px) {
  .dashboard-hero {
    padding: 1.5rem;
    border-radius: 20px;
    margin-bottom: 1.75rem;
    gap: 1.25rem;
  }

  .hero-content h1 {
    font-size: 1.65rem;
    margin-bottom: 0.5rem;
  }

  .hero-content p {
    font-size: 0.85rem;
    margin-bottom: 1rem;
    opacity: 0.9;
  }

  .hero-content div[style*="display:flex"] {
    gap: 1rem !important;
    margin-top: 1rem !important;
  }

  .hero-stats {
    gap: 1rem;
    margin-bottom: 0.75rem;
  }

  .stat-num {
    font-size: 1.2rem;
  }

  .hero-shortcuts {
    gap: 0.625rem;
  }

  .shortcut-btn {
    padding: 0.75rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: 14px;
    gap: 0.5rem;
  }

  .shortcut-btn i {
    width: 16px;
    height: 16px;
  }

  .hero-content .btn-guide-main {
    padding: 0.5rem 1rem !important;
    font-size: 0.8125rem;
    border-radius: 10px !important;
  }
}

@media (max-width: 600px) {
  .tabs {
    gap: 0.35rem !important;
    margin-bottom: 1.5rem !important;
  }

  .tab {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.75rem !important;
    border-radius: 10px !important;
  }

  .card-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  .card {
    padding: 1.5rem !important;
    border-radius: 20px !important;
  }

  .card-header {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 1rem !important;
    margin-bottom: 1rem !important;
  }

  .card-title {
    font-size: 1.05rem !important;
    margin: 0 !important;
  }

  .card p {
    font-size: 0.8125rem !important;
    margin-bottom: 1.25rem !important;
  }
}

@media (max-width: 600px) {
  #dashboard-view .card {
    display: block !important;
    padding: 1.5rem !important;
  }

  #dashboard-view .card-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 1rem !important;
  }

  #dashboard-view .card-title {
    display: block !important;
    grid-column: auto !important;
    grid-row: auto !important;
    margin: 0 !important;
    font-size: 1.05rem !important;
  }

  #dashboard-view .card-icon {
    display: flex !important;
    grid-column: auto !important;
    grid-row: auto !important;
    width: 44px !important;
    height: 44px !important;
  }

  #dashboard-view .card p {
    display: block !important;
    grid-column: auto !important;
    grid-row: auto !important;
    margin-top: 0.5rem !important;
    font-size: 0.8125rem !important;
  }

  #dashboard-view .btn-hasikan {
    width: 100% !important;
    margin-top: 1rem !important;
  }
}

@media (max-width: 600px) {
  .app-footer {
    padding: 3rem 1.5rem 1.5rem !important;
    margin-top: 3.5rem !important;
    text-align: center !important;
  }

  .footer-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 1.75rem !important;
    margin-bottom: 2rem !important;
  }

  .footer-brand {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  .footer-brand p {
    max-width: 100% !important;
    font-size: 0.8125rem !important;
    line-height: 1.4 !important;
  }

  .footer-nav {
    display: flex !important;
    justify-content: center !important;
    gap: 1rem 1.5rem !important;
  }

  .footer-nav a {
    font-size: 0.8125rem !important;
  }

  .footer-bottom {
    padding-top: 1.5rem !important;
    font-size: 0.75rem !important;
  }
}

@media (max-width: 600px) {
  .legal-page {
    padding: 2rem 1.25rem !important;
    margin-top: 1rem !important;
  }

  .legal-page h2 {
    font-size: 1.65rem !important;
    margin-bottom: 1.5rem !important;
    line-height: 1.25 !important;
    letter-spacing: -0.01em !important;
  }

  .legal-page h3 {
    font-size: 1.15rem !important;
    margin-bottom: 1rem !important;
  }

  .legal-page p,
  .legal-page li {
    font-size: 0.8125rem !important;
    line-height: 1.6 !important;
  }

  .legal-page section {
    margin-bottom: 2rem !important;
  }
}

/* Immersive Mode fixes for Mobile (No cut-off) */

.main-content {
  min-height: 100dvh !important;
  display: flex !important;
  flex-direction: column !important;
}

.chat-layout {
  min-height: 80vh !important;
}

@media (max-width: 768px) {
  .chat-bubble {
    font-size: 0.75rem !important;
  }

  .chat-layout {
    height: 75dvh !important;
  }

  .chat-content-area {
    height: 100% !important;
    overflow: hidden !important;
  }
}






/* Chat Full Screen / Wide Mode */
.chat-layout.wide {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2000 !important;
  height: 100dvh !important;
  height: -webkit-fill-available !important;
  width: 100dvw !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  background: white !important;
}

.chat-layout.wide .chat-sidebar {
  display: none !important;
}

.chat-layout.wide .chat-content-area {
  height: 100dvh !important;
}

.chat-layout.wide .chat-messages {
  padding: 1rem !important;
}

@media (max-width: 768px) {
  .chat-layout.wide .chat-header {
    padding: 1rem !important;
  }

  .chat-layout.wide .chat-input-area {
    padding: 0.75rem !important;
    margin-bottom: 0px !important;
  }
}

/* Dashboard Hero Upgrade */
.hero-glass-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 100%;
  max-width: 380px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.hero-shortcuts-external {
  margin-bottom: 2.5rem;
}

.shortcut-grid-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.shortcut-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border-light);
  border-radius: 20px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.shortcut-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  background: var(--bg-main);
}

.shortcut-card h4 {
  font-size: 1.1rem;
  color: var(--text-main);
  transition: color 0.3s ease;
}

.shortcut-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

[data-theme="dark"] .shortcut-card {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .shortcut-card p {
  color: rgba(248, 250, 252, 0.6) !important;
}

.shortcut-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.shortcut-icon i {
  width: 22px;
  height: 22px;
}

.icon-writer {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  box-shadow: 0 8px 16px rgba(79, 70, 229, 0.2);
}

.icon-chat {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow: 0 8px 16px rgba(124, 58, 237, 0.2);
}

.icon-code {
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  box-shadow: 0 8px 16px rgba(14, 165, 233, 0.2);
}

.icon-book {
  background: linear-gradient(135deg, #10b981, #34d399);
  box-shadow: 0 8px 16px rgba(16, 185, 129, 0.2);
}

/* --- Visibility Upgrades for Dark Mode (Cyber Cyan Edition) --- */
[data-theme="dark"] .badge.bg-writer,
[data-theme="dark"] .badge.bg-code,
[data-theme="dark"] .btn-action-p.primary,
[data-theme="dark"] .nav-link.active,
[data-theme="dark"] .nav-item-dropdown.active>.nav-link,
[data-theme="dark"] .sub-nav-link.active,
[data-theme="dark"] .outcome-badge,
[data-theme="dark"] .mode-tab.active {
  background: rgba(34, 211, 238, 0.1) !important;
  color: #22D3EE !important;
  border-color: rgba(34, 211, 238, 0.2) !important;
}

/* Icons & Hovers & Special Elements */
[data-theme="dark"] .btn-action-p.primary i,
[data-theme="dark"] .nav-link.active i,
[data-theme="dark"] .sub-nav-link.active i,
[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .sub-nav-link:hover,
[data-theme="dark"] .nav-link:hover i,
[data-theme="dark"] .sub-nav-link:hover i,
[data-theme="dark"] .mode-tab:hover {
  color: #22D3EE !important;
}

/* Guide Header Transformation */
[data-theme="dark"] .guide-header {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%) !important;
  border: 1px solid rgba(34, 211, 238, 0.15) !important;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(34, 211, 238, 0.05) !important;
}

/* Bright Cyan Elements (Numbers & Buttons) */
[data-theme="dark"] .step-number,
[data-theme="dark"] .btn-guide,
[data-theme="dark"] .btn-action-p.primary:hover {
  background: #22D3EE !important;
  color: #0F172A !important;
}

[data-theme="dark"] .step-number {
  box-shadow: 0 5px 15px rgba(34, 211, 238, 0.4) !important;
}

[data-theme="dark"] .btn-action-p.primary:hover i,
[data-theme="dark"] .btn-guide i {
  color: #0F172A !important;
}

[data-theme="dark"] .nav-item-dropdown.active .sub-menu {
  border-left-color: rgba(34, 211, 238, 0.4) !important;
}

[data-theme="dark"] .step-card:hover {
  border-color: rgba(34, 211, 238, 0.4) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
}

/* Pricing Hierarchy Buttons */
.btn-success {
  background: #10B981 !important;
  color: white !important;
  border-color: #10B981 !important;
  cursor: default !important;
  pointer-events: none;
}

.btn-disabled {
  background: var(--bg-main) !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border-light) !important;
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* ==========================================================================
   MODERN AUTH MOBILE REFINEMENT
   ========================================================================== */
.logo-icon-auth {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: white;
  box-shadow: 0 10px 20px var(--primary-glow);
}

.logo-icon-auth i {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.75rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
  max-width: 280px;
  margin: 0 auto;
  line-height: 1.5;
}

.google-auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
  content: \\;
  flex: 1;
  height: 1px;
  background: var(--border-light);
  opacity: 0.6;
}

/* Mobile Specific Adjustments */
@media (max-width: 480px) {
  .modal-auth-content {
    padding: 2rem 1.5rem !important;
    max-width: 90% !important;
    border-radius: 28px !important;
  }

  .auth-title {
    font-size: 1.5rem;
  }

  .auth-subtitle {
    font-size: 0.875rem;
  }

  .form-group label {
    font-size: 0.8125rem;
    margin-bottom: 0.4rem;
  }

  .form-group input {
    height: 48px !important;
    font-size: 0.9375rem !important;
    border-radius: 12px !important;
    padding: 0 1rem !important;
  }

  .btn-hasikan {
    height: 50px !important;
    border-radius: 14px !important;
    font-size: 0.9375rem !important;
  }
}


.modal-auth-content .btn-hasikan {
  width: 100% !important;
  margin-top: 1rem !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}


/* MOBIL REFINEMENT: BURGER & ACCOUNT */
.sidebar-overlay {
  display: none !important;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block !important;
}

@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    left: -280px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.active {
    left: 0;
  }

  .account-profile-card .profile-content {
    align-items: center !important;
    text-align: center !important;
    padding: 0 1.5rem 2.5rem !important;
  }

  .account-profile-card .profile-info>div {
    flex-direction: column !important;
    gap: 1.5rem !important;
    align-items: center !important;
  }

  .account-profile-card .badge-row {
    justify-content: center !important;
  }

  /* Usage Stats Centering on Mobile */
  .usage-info {
    flex-direction: column !important;
    gap: 0.5rem !important;
    text-align: center !important;
    margin-bottom: 0.75rem !important;
  }
}

/* Fix for Statistik Teks Overlapping */
.usage-info span:first-child {
  font-weight: 500;
}

.usage-info span:last-child {
  font-weight: 800;
  color: var(--text-main);
}


/* FINAL ACCOUNT MOBILE REFINEMENT */
@media (max-width: 768px) {
  #account-view .account-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
  }

  .account-profile-card .profile-header-bg {
    height: 100px !important;
  }

  .account-profile-card .profile-content {
    margin-top: -40px !important;
    padding: 0 1rem 2rem !important;
  }

  .profile-avatar-large {
    width: 80px !important;
    height: 80px !important;
    font-size: 1.5rem !important;
    border-width: 3px !important;
  }

  .profile-info h3 {
    font-size: 1.25rem !important;
  }

  /* Prevent Overlap by making headers clear */
  .card-header-simple {
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.5rem !important;
    text-align: center !important;
  }

  /* Tabular data to cards on mobile */
  .docs-table thead {
    display: none !important;
  }

  .docs-table tbody tr {
    display: block !important;
    background: var(--bg-main) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: 16px !important;
    margin-bottom: 1rem !important;
    padding: 1.25rem !important;
    box-shadow: var(--shadow-sm) !important;
  }

  .docs-table td {
    display: flex !important;
    justify-content: space-between !important;
    padding: 0.5rem 0 !important;
    border: none !important;
    font-size: 0.875rem !important;
    text-align: right !important;
  }

  .docs-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
    text-align: left;
    margin-right: 10px;
  }
}


/* COMPACT ACCOUNT MOBILE REFINEMENT - V3 */
@media (max-width: 991px) {
  #account-view .card {
    display: block !important;
    width: 100% !important;
    padding: 1.25rem 1rem !important;
    border-radius: 20px !important;
    margin-top: 1rem !important;
    text-align: center !important;
    box-shadow: var(--shadow-md) !important;
  }

  /* Reset Profile Card Flex */
  .account-profile-card {
    display: block !important;
  }

  /* Header Title Always Top */
  .card-header-simple {
    display: block !important;
    margin-bottom: 1rem !important;
    text-align: center !important;
  }

  .card-header-simple h3 {
    margin-bottom: 0.5rem !important;
    display: block !important;
  }

  .card-header-simple i {
    display: inline-block !important;
    margin-top: 0.25rem !important;
  }

  /* More Compact Info Items */
  .usage-item {
    gap: 0.5rem !important;
  }

  .usage-info {
    font-size: 0.8125rem !important;
    margin-bottom: 0.25rem !important;
  }

  /* Profile Refinement: No more Side-bar gradient */
  .profile-header-bg {
    width: 100% !important;
    height: 80px !important;
    position: relative !important;
    display: block !important;
  }

  .profile-content {
    display: block !important;
    width: 100% !important;
    margin-top: -35px !important;
    padding: 0 !important;
  }

  .profile-avatar-large {
    margin: 0 auto 1rem !important;
  }

  .profile-info {
    text-align: center !important;
  }

  .profile-info>div {
    display: block !important;
    width: 100% !important;
  }

  .profile-info h3 {
    font-size: 1.15rem !important;
    margin-bottom: 0.2rem !important;
  }

  #btn-acc-upgrade {
    display: inline-flex !important;
    margin-top: 1.25rem !important;
    font-size: 0.85rem !important;
    padding: 0.6rem 1.25rem !important;
  }

  /* Compact Order History List */
  .docs-table tbody tr {
    padding: 0.875rem !important;
    border-radius: 12px !important;
    background: var(--card-bg) !important;
  }

  .docs-table td {
    padding: 0.3rem 0 !important;
    font-size: 0.8125rem !important;
  }
}


/* FULL-WIDTH CARD REFINEMENT FOR MOBILE */
@media (max-width: 768px) {
  .main-content {
    padding: 1rem 0.75rem !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }

  #account-view .card,
  #account-view .account-profile-card,
  #account-view .usage-item {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    display: block !important;
  }

  .account-grid,
  .account-main {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
  }

  /* Final Polish for the Profile Card on Mobile */
  .account-profile-card .profile-content {
    width: 100% !important;
    padding: 0 1rem 2rem !important;
    text-align: center !important;
  }

  .profile-header-bg {
    border-radius: 20px 20px 0 0 !important;
  }
}


/* FULL-WIDTH HISTORY REFINEMENT */
@media (max-width: 768px) {
  .order-history-wrap {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .docs-table {
    width: 100% !important;
    display: block !important;
  }

  .docs-table tbody {
    display: block !important;
    width: 100% !important;
  }

  .docs-table tr {
    width: 100% !important;
    box-sizing: border-box !important;
  }
}


/* FIX NARROW MOBILE VIEWS */
@media (max-width: 991px) {
  .main-content {
    max-width: 100% !important;
    width: 100vw !important;
    padding: 1rem !important;
    margin: 0 !important;
  }

  .app {
    overflow-x: hidden !important;
  }
}



/* ==========================================================================
   PRICING VIEW REFINEMENT (MOBILE & DESKTOP)
   ========================================================================== */
#pricing-view {
  padding: 4rem 1.5rem !important;
  background: var(--bg-main) !important;
  min-height: 100vh !important;
  text-align: center;
}

.pricing-hero {
  max-width: 900px;
  margin: 0 auto 4rem;
}

#pricing-hero-title {
  font-size: 2rem !important;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1rem;
  line-height: 1.2;
}

.pricing-grid {
  display: flex !important;
  flex-direction: row;
  justify-content: center;
  align-items: stretch;
  gap: 2rem;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
}

.pricing-card {
  background: var(--card-bg) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: 24px !important;
  padding: 2.5rem 2rem !important;
  width: 340px;
  display: flex;
  flex-direction: column;
  transition: var(--transition) !important;
  position: relative;
  box-shadow: var(--shadow-md);
}

.pricing-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.pricing-card.popular {
  border: 2px solid var(--primary) !important;
  transform: scale(1.05);
  z-index: 10;
}

.pricing-card.popular:hover {
  transform: scale(1.05) translateY(-8px);
}

.popular-badge {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 6px 20px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.pricing-header {
  margin-bottom: 2rem;
}

.pricing-name {
  font-size: 0.875rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
}

.pricing-price {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 4px;
  color: var(--text-main);
}

.pricing-price .currency {
  font-size: 1.25rem;
  font-weight: 700;
  align-self: flex-start;
  margin-top: 0.5rem;
}

.pricing-price .amount {
  font-size: 3.5rem;
  font-weight: 800;
}

.pricing-price .period {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.pricing-features {
  list-style: none;
  padding: 1.5rem 0 0 !important;
  margin: 1.5rem 0 2.5rem !important;
  border-top: 1px solid var(--border-light);
  flex-grow: 1;
  text-align: left;
}

.pricing-features li {
  margin-bottom: 1rem !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  font-size: 0.9375rem !important;
  color: var(--text-muted) !important;
}

.pricing-features i {
  color: #22C55E !important;
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0;
}

.btn-plan {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 14px;
  padding: 1rem 1.5rem;
  text-decoration: none;
  display: block;
  text-align: center;
  font-weight: 700;
  font-size: 0.9375rem;
  transition: var(--transition);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-plan:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--primary-glow);
  color: white;
}

.pricing-card:not(.popular) .btn-plan {
  background: var(--input-bg);
  color: var(--text-main);
  box-shadow: none;
  border: 1px solid var(--border-light);
}

.pricing-card:not(.popular) .btn-plan:hover {
  background: var(--border-light);
}

@media (max-width: 991px) {
  .pricing-grid {
    flex-direction: column !important;
    align-items: center !important;
    margin-top: 0 !important;
  }

  .pricing-card {
    width: 100% !important;
    max-width: 360px !important;
    padding: 2.5rem 1.75rem !important;
  }

  .pricing-card.popular {
    transform: none !important;
    margin: 1rem 0 !important;
  }

  .pricing-card.popular:hover {
    transform: translateY(-8px) !important;
  }
}


/* PRICING VIEW MOBILE REFINEMENT */
@media (max-width: 991px) {
  .pricing-grid {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 1rem !important;
    gap: 1.5rem !important;
  }

  .pricing-card {
    width: 100% !important;
    max-width: 400px !important;
    padding: 2rem 1.25rem !important;
    transform: none !important;
    /* Remove scale(1.05) */
    margin: 0 !important;
    box-shadow: var(--shadow-lg) !important;
  }

  .pricing-card.popular {
    order: -1;
    /* Show popular on top */
    border-width: 2px !important;
  }

  .pricing-header {
    margin-bottom: 1.5rem !important;
  }

  .pricing-price .amount {
    font-size: 2.75rem !important;
  }

  .pricing-price .currency {
    font-size: 1rem !important;
  }

  .pricing-features {
    margin-bottom: 2rem !important;
  }

  .pricing-features li {
    font-size: 0.875rem !important;
    margin-bottom: 0.875rem !important;
    text-align: left !important;
  }

  /* Ensure button is clickable and visible */
  .pricing-card .btn-block {
    width: 100% !important;
    padding: 12px !important;
    font-size: 0.9375rem !important;
    position: relative !important;
    z-index: 10 !important;
    display: block !important;
  }
}


@media (max-width: 768px) {
  #pricing-hero-title {
    font-size: 2rem !important;
    padding: 0 1rem !important;
  }

  #pricing-view .section-subheading {
    padding: 0 1.5rem !important;
    font-size: 0.9375rem !important;
  }
}


/* FINAL PRICING MOBILE FIX - V4 */
@media (max-width: 991px) {
  #pricing-hero-title {
    font-size: 1.75rem !important;
    line-height: 1.1 !important;
    margin-bottom: 0.75rem !important;
  }

  #pricing-view .pricing-grid {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    gap: 3rem !important;
    /* More gap for clarity */
    padding: 0 !important;
  }

  #pricing-view .pricing-card {
    display: flex !important;
    flex-direction: column !important;
    width: 95% !important;
    max-width: 95% !important;
    padding: 2.5rem 1.5rem !important;
    height: auto !important;
    position: relative !important;
  }

  /* Layout: Header (Name+Price) -> Features -> Button */
  .pricing-header {
    text-align: center !important;
    width: 100% !important;
    margin-bottom: 1.5rem !important;
  }

  .pricing-price {
    display: flex !important;
    justify-content: center !important;
    align-items: baseline !important;
    gap: 0.25rem !important;
  }

  .pricing-price .amount {
    font-size: 3rem !important;
    /* Large but not too large */
    line-height: 1 !important;
  }

  .pricing-features {
    width: 100% !important;
    margin-bottom: 2rem !important;
    display: block !important;
  }

  .pricing-features li {
    display: flex !important;
    justify-content: flex-start !important;
    text-align: left !important;
  }

  /* Ensure button is at bottom and wide */
  #pricing-view .btn-block {
    width: 100% !important;
    margin-top: auto !important;
    position: relative !important;
    z-index: 20 !important;
    pointer-events: auto !important;
    visibility: visible !important;
  }

  .popular::before {
    display: none !important;
    /* Hide weird pseudo elements if any */
  }
}


/* ULTRA-COMPACT PRICING MOBILE - V5 */
@media (max-width: 991px) {
  #pricing-hero-title {
    font-size: 1.35rem !important;
    line-height: 0.95 !important;
    letter-spacing: -0.04em !important;
    margin-bottom: 0.5rem !important;
    font-family: 'Outfit', sans-serif !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    color: var(--text-main) !important;
  }

  #pricing-view .section-subheading {
    font-size: 0.8125rem !important;
    line-height: 1.3 !important;
    margin-bottom: 1rem !important;
    opacity: 0.7 !important;
  }

  .pricing-price .amount {
    font-size: 2.25rem !important;
  }

  .pricing-price .currency {
    font-size: 0.875rem !important;
  }

  .pricing-price .period {
    font-size: 0.75rem !important;
  }

  /* Make cards even more compact */
  #pricing-view .pricing-card {
    padding: 1.5rem 1rem !important;
    gap: 1rem !important;
  }

  .pricing-features {
    margin-bottom: 1rem !important;
  }

  .pricing-features li {
    font-size: 0.8125rem !important;
    margin-bottom: 0.5rem !important;
    gap: 0.5rem !important;
  }
}


/* FINAL CACHE BUSTER & MOBILE COMPACT FIX */
@media (max-width: 900px) {
  #pricing-hero-title {
    font-size: 1.3rem !important;
    line-height: 0.95 !important;
    letter-spacing: -0.04em !important;
    text-transform: uppercase !important;
    font-weight: 800 !important;
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 0 1rem !important;
    color: var(--text-main) !important;
    margin-top: 0 !important;
  }
}


/* FINAL PRICING TWEAKS: ORDER & COMPACTNESS */
#pricing-view {
  background: var(--bg-main) !important;
  padding: 1.5rem !important;
  border-radius: 20px !important;
}

.pricing-hero-wrap {
  text-align: center !important;
  width: 100% !important;
  margin-top: 2rem !important;
  margin-bottom: 3rem !important;
}

@media (max-width: 991px) {
  .pricing-hero-wrap {
    margin-top: 0.5rem !important;
    margin-bottom: 1.5rem !important;
  }

  /* Restore original sequence: Basic -> Pro -> Unlimited */
  .pricing-card.popular {
    order: 0 !important;
  }

  .pricing-card {
    order: 0 !important;
  }
}


/* DESKTOP PRICING 1-ROW REFINEMENT */
@media (min-width: 992px) {
  .pricing-grid {
    display: flex !important;
    flex-wrap: nowrap !important;
    /* Force one row */
    justify-content: center !important;
    gap: 1.25rem !important;
    /* Slightly smaller gap to save space */
  }

  .pricing-card {
    width: 300px !important;
    /* Smaller width to ensure 3 cards fit side-by-side */
    padding: 2.5rem 1.5rem !important;
  }

  .pricing-card.popular {
    width: 310px !important;
    /* Maintain slight emphasis but smaller */
    transform: scale(1.03) !important;
  }
}


/* MOBIL CHAT REFINEMENT - V2 */
@media (max-width: 991px) {
  #btn-close-chat-sidebar {
    display: flex !important;
    position: absolute !important;
    top: 1.5rem !important;
    right: 1.5rem !important;
    background: white !important;
    border: 1px solid var(--border-light) !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    justify-content: center !important;
    align-items: center !important;
    box-shadow: var(--shadow-md) !important;
    z-index: 9999 !important;
    cursor: pointer !important;
  }
}


/* ULTRA VISIBLE CHAT CLOSE BUTTON */
@media (max-width: 991px) {
  #btn-close-chat-sidebar {
    display: flex !important;
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    width: 44px !important;
    height: 44px !important;
    background: #ef4444 !important;
    /* RED BACKGROUND */
    color: white !important;
    border-radius: 50% !important;
    z-index: 10000 !important;
    justify-content: center !important;
    align-items: center !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4) !important;
    border: 2px solid white !important;
  }

  #btn-close-chat-sidebar i {
    width: 24px !important;
    height: 24px !important;
    color: white !important;
  }
}


/* MOBIL CHAT REFINEMENT - V3: CLEAN HEADER */
@media (max-width: 991px) {
  #btn-close-chat-sidebar {
    display: flex !important;
    position: static !important;
    /* Move it into the flex flow */
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    color: var(--text-muted) !important;
  }

  #btn-close-chat-sidebar i {
    color: var(--text-muted) !important;
  }

  #back-to-personas {
    flex-grow: 1 !important;
    max-width: 70% !important;
    margin: 0 !important;
    height: 44px !important;
    padding: 0 1rem !important;
    font-size: 0.85rem !important;
    white-space: nowrap !important;
  }

  .chat-sidebar-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    padding: 0.75rem 1rem !important;
  }
}
/* OpenAlex Reference Cards */
.ref-card { background: var(--card-bg); border: 1px solid var(--border-light); border-radius: 12px; padding: 1.25rem; margin-bottom: 0.875rem; box-shadow: var(--shadow-sm); transition: var(--transition); }
.ref-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.ref-title { font-weight: 700; font-size: 0.95rem; line-height: 1.55; margin-bottom: 0.625rem; color: var(--text-main); }
.ref-meta { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: 1rem; }
.ref-meta span { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.5rem; }
.ref-actions { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border-light); padding-top: 0.875rem; }
.ref-source-link { font-size: 0.75rem; color: var(--primary); text-decoration: none; display: flex; align-items: center; gap: 0.375rem; font-weight: 600; }
.btn-use-ref { padding: 7px 16px; font-size: 0.75rem; border-radius: 8px; background: var(--primary); color: white; border: none; cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; transition: var(--transition); }
.btn-use-ref:hover { filter: brightness(1.1); transform: scale(1.02); }

/* Compact OpenAlex Results */
.ref-card.compact { padding: 0.75rem !important; margin-bottom: 0.5rem !important; }
.ref-card.compact .ref-title { font-size: 0.85rem !important; margin-bottom: 0.25rem !important; line-height: 1.3 !important; }
.ref-card.compact .ref-meta { gap: 0.15rem !important; margin-bottom: 0.5rem !important; }
.ref-card.compact .ref-meta span { font-size: 0.7rem !important; }
.ref-card.compact .ref-actions { padding-top: 0.5rem !important; }
.ref-card.compact .btn-use-ref { padding: 4px 10px !important; font-size: 0.7rem !important; border-radius: 6px !important; }
.ref-card.compact .ref-source-link { font-size: 0.7rem !important; }
