/* ===== CSS Variables ===== */
:root {
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --primary-light: #818CF8;
  --secondary: #0EA5E9;
  --accent: #F59E0B;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --sidebar-width: 260px;
  --header-height: 64px;
  --font-sans: 'Noto Sans Thai', 'Inter', system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px rgba(0,0,0,.1), 0 10px 10px rgba(0,0,0,.04);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-sans); color: var(--gray-800); line-height: 1.6; background: #fff; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ===== Utilities ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-lg { max-width: 1400px; margin: 0 auto; padding: 0 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }
.text-4xl { font-size: 36px; }
.text-5xl { font-size: 48px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-primary { color: var(--primary); }
.text-gray-400 { color: var(--gray-400); }
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-white { color: #fff; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.bg-primary { background: var(--primary); }
.bg-white { background: #fff; }
.bg-gray-50 { background: var(--gray-50); }
.bg-gray-100 { background: var(--gray-100); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: 9999px; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opacity-0 { opacity: 0; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; font-size: 14px; font-weight: 600; border-radius: var(--radius); transition: all .2s; border: 1px solid transparent; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-xl { padding: 16px 32px; font-size: 18px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-outline { border: 1.5px solid var(--gray-300); color: var(--gray-700); background: transparent; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-white { background: #fff; color: var(--gray-800); box-shadow: var(--shadow-sm); }
.btn-white:hover { box-shadow: var(--shadow); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .icon { width: 18px; height: 18px; }

/* ===== Form Elements ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 10px 14px; border: 1.5px solid var(--gray-300); border-radius: var(--radius); font-size: 14px; color: var(--gray-800); background: #fff; transition: border-color .2s, box-shadow .2s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.form-input::placeholder { color: var(--gray-400); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-error { font-size: 13px; color: var(--danger); margin-top: 4px; }
.form-hint { font-size: 13px; color: var(--gray-500); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-checkbox { display: flex; align-items: center; gap: 8px; }
.form-checkbox input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }

/* ===== Cards ===== */
.card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 24px; }
.card-shadow { box-shadow: var(--shadow); border: none; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--gray-100); }
.card-title { font-size: 16px; font-weight: 600; color: var(--gray-800); }

/* ===== Tables ===== */
.table-container { overflow-x: auto; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; }
.table th { background: var(--gray-50); padding: 12px 16px; text-align: left; font-size: 13px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--gray-200); }
.table td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--gray-100); }
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

/* ===== Badges ===== */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; font-size: 12px; font-weight: 600; border-radius: 9999px; }
.badge-primary { background: #EEF2FF; color: var(--primary); }
.badge-success { background: #ECFDF5; color: #059669; }
.badge-warning { background: #FFFBEB; color: #D97706; }
.badge-danger { background: #FEF2F2; color: #DC2626; }
.badge-info { background: #EFF6FF; color: #2563EB; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ===== KPI Cards ===== */
.kpi-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 20px; }
.kpi-label { font-size: 13px; color: var(--gray-500); margin-bottom: 4px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--gray-800); }
.kpi-change { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; margin-top: 4px; }
.kpi-change.up { color: var(--success); }
.kpi-change.down { color: var(--danger); }
.kpi-icon { width: 48px; height: 48px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 22px; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .2s; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal { background: #fff; border-radius: var(--radius-xl); width: 90%; max-width: 600px; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-xl); transform: translateY(20px); transition: transform .2s; }
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--gray-200); }
.modal-title { font-size: 18px; font-weight: 600; }
.modal-close { width: 36px; height: 36px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; background: none; color: var(--gray-400); font-size: 20px; }
.modal-close:hover { background: var(--gray-100); color: var(--gray-600); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--gray-200); }

/* ===== Toast ===== */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 14px 20px; border-radius: var(--radius); color: #fff; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); animation: slideIn .3s ease; min-width: 300px; display: flex; align-items: center; gap: 10px; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Pagination ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 20px; }
.pagination button { padding: 8px 14px; border: 1px solid var(--gray-300); border-radius: var(--radius); background: #fff; font-size: 14px; color: var(--gray-700); }
.pagination button:hover { background: var(--gray-50); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: .5; cursor: default; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; }
.tab { padding: 10px 20px; font-size: 14px; font-weight: 500; color: var(--gray-500); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; cursor: pointer; }
.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; color: var(--gray-700); margin-bottom: 8px; }
.empty-state p { color: var(--gray-500); margin-bottom: 20px; }

/* ===== Loading ===== */
.spinner { width: 40px; height: 40px; border: 3px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { position: absolute; inset: 0; background: rgba(255,255,255,.8); display: flex; align-items: center; justify-content: center; z-index: 10; border-radius: var(--radius-lg); }

/* ===== Dropdown ===== */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 180px; z-index: 100; display: none; }
.dropdown-menu.show { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; font-size: 14px; color: var(--gray-700); cursor: pointer; }
.dropdown-item:hover { background: var(--gray-50); }
.dropdown-divider { height: 1px; background: var(--gray-200); margin: 4px 0; }

/* ===== LANDING PAGE ===== */

/* Navbar */
.landing-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: rgba(255,255,255,.95); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(0,0,0,.05); transition: all .3s; }
.landing-nav.scrolled { box-shadow: var(--shadow); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.nav-logo { font-size: 22px; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.nav-logo span { background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-links a { font-size: 15px; font-weight: 500; color: var(--gray-600); transition: color .2s; }
.nav-links a:hover { color: var(--primary); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-mobile-toggle { display: none; background: none; font-size: 24px; color: var(--gray-700); }

/* Hero */
.hero { padding: 140px 0 80px; background: linear-gradient(135deg, #F5F3FF 0%, #EEF2FF 50%, #E0F2FE 100%); position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; width: 600px; height: 600px; background: radial-gradient(circle, rgba(79,70,229,.08), transparent); top: -200px; right: -200px; border-radius: 50%; }
.hero::after { content: ''; position: absolute; width: 400px; height: 400px; background: radial-gradient(circle, rgba(14,165,233,.06), transparent); bottom: -100px; left: -100px; border-radius: 50%; }
.hero-content { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; position: relative; z-index: 1; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; background: rgba(79,70,229,.1); color: var(--primary); font-size: 14px; font-weight: 600; border-radius: 9999px; margin-bottom: 20px; }
.hero h1 { font-size: 48px; font-weight: 800; line-height: 1.15; color: var(--gray-900); margin-bottom: 20px; }
.hero h1 .gradient-text { background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 18px; color: var(--gray-600); line-height: 1.7; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 16px; align-items: center; }
.hero-stats { display: flex; gap: 40px; margin-top: 48px; }
.hero-stat { text-align: center; }
.hero-stat .num { font-size: 32px; font-weight: 800; color: var(--primary); }
.hero-stat .label { font-size: 14px; color: var(--gray-500); }
.hero-visual { position: relative; }
.hero-mockup { background: #fff; border-radius: 16px; box-shadow: var(--shadow-xl); padding: 20px; border: 1px solid var(--gray-200); }
.hero-mockup-header { display: flex; gap: 6px; margin-bottom: 16px; }
.hero-mockup-dot { width: 10px; height: 10px; border-radius: 50%; }
.hero-mockup-content { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mockup-card { background: var(--gray-50); border-radius: 8px; padding: 16px; }
.mockup-card .num { font-size: 22px; font-weight: 700; }
.mockup-chart { height: 120px; background: linear-gradient(180deg, rgba(79,70,229,.1), transparent); border-radius: 8px; margin-top: 12px; position: relative; overflow: hidden; }
.mockup-chart-line { position: absolute; bottom: 0; left: 0; right: 0; height: 60%; background: linear-gradient(180deg, rgba(79,70,229,.15), rgba(79,70,229,.02)); border-top: 2px solid var(--primary); }

/* Features */
.section { padding: 80px 0; }
.section-header { text-align: center; margin-bottom: 60px; }
.section-header .badge { margin-bottom: 12px; }
.section-header h2 { font-size: 36px; font-weight: 700; color: var(--gray-900); margin-bottom: 16px; }
.section-header p { font-size: 18px; color: var(--gray-500); max-width: 600px; margin: 0 auto; }
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.feature-card { padding: 32px; border: 1px solid var(--gray-200); border-radius: var(--radius-xl); transition: all .3s; }
.feature-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.feature-icon { width: 56px; height: 56px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 26px; margin-bottom: 16px; }
.feature-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--gray-500); line-height: 1.6; }
.feature-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.feature-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gray-600); }
.feature-list li::before { content: '✓'; color: var(--success); font-weight: 700; }

/* Pricing */
.pricing-section { background: var(--gray-50); }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; max-width: 1000px; margin: 0 auto; }
.pricing-card { background: #fff; border: 2px solid var(--gray-200); border-radius: var(--radius-xl); padding: 36px; transition: all .3s; position: relative; }
.pricing-card.featured { border-color: var(--primary); transform: scale(1.05); box-shadow: var(--shadow-xl); }
.pricing-card.featured::before { content: 'แนะนำ'; position: absolute; top: -14px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; padding: 4px 20px; border-radius: 9999px; font-size: 13px; font-weight: 600; }
.pricing-name { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.pricing-desc { font-size: 14px; color: var(--gray-500); margin-bottom: 24px; }
.pricing-price { margin-bottom: 24px; }
.pricing-price .amount { font-size: 42px; font-weight: 800; color: var(--gray-900); }
.pricing-price .period { font-size: 16px; color: var(--gray-400); }
.pricing-features { list-style: none; margin-bottom: 32px; }
.pricing-features li { padding: 8px 0; font-size: 14px; color: var(--gray-600); display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--gray-100); }
.pricing-features li:last-child { border-bottom: none; }
.pricing-features .check { color: var(--success); font-weight: 700; }
.pricing-features .cross { color: var(--gray-300); }

/* CTA */
.cta-section { background: linear-gradient(135deg, var(--primary), #7C3AED); padding: 80px 0; text-align: center; color: #fff; }
.cta-section h2 { font-size: 36px; font-weight: 700; margin-bottom: 16px; }
.cta-section p { font-size: 18px; opacity: .9; margin-bottom: 32px; }

/* Footer */
.footer { background: var(--gray-900); color: var(--gray-400); padding: 60px 0 30px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-brand h3 { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 12px; }
.footer-brand p { font-size: 14px; line-height: 1.7; }
.footer-links h4 { color: #fff; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 16px; }
.footer-links a { display: block; font-size: 14px; padding: 4px 0; transition: color .2s; }
.footer-links a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid var(--gray-800); padding-top: 24px; text-align: center; font-size: 14px; }

/* ===== APP LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: var(--sidebar-width); background: var(--gray-900); color: #fff; position: fixed; top: 0; bottom: 0; left: 0; overflow-y: auto; z-index: 50; transition: transform .3s; }
.sidebar-header { padding: 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--gray-800); }
.sidebar-logo { font-size: 18px; font-weight: 800; }
.sidebar-logo span { background: linear-gradient(135deg, var(--primary-light), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar-nav { padding: 12px 0; }
.nav-section { padding: 8px 20px 4px; font-size: 11px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .08em; margin-top: 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 20px; font-size: 14px; color: var(--gray-400); cursor: pointer; transition: all .15s; border-left: 3px solid transparent; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: rgba(79,70,229,.15); border-left-color: var(--primary-light); }
.nav-item .icon { width: 20px; text-align: center; font-size: 16px; }
.nav-item .badge-count { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 9999px; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--gray-800); }

/* Main Content */
.main-content { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; background: var(--gray-50); }

/* Header */
.app-header { height: var(--header-height); background: #fff; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 40; }
.header-left { display: flex; align-items: center; gap: 16px; }
.header-title { font-size: 18px; font-weight: 600; color: var(--gray-800); }
.header-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gray-500); }
.header-breadcrumb a { color: var(--gray-500); }
.header-breadcrumb a:hover { color: var(--primary); }
.header-right { display: flex; align-items: center; gap: 16px; }
.header-icon-btn { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; background: none; color: var(--gray-500); font-size: 20px; position: relative; }
.header-icon-btn:hover { background: var(--gray-100); }
.header-icon-btn .badge-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid #fff; }
.header-user { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 10px; border-radius: var(--radius); }
.header-user:hover { background: var(--gray-100); }
.header-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.mobile-toggle { display: none; background: none; font-size: 24px; color: var(--gray-600); }

/* Page Content */
.page-content { padding: 24px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 24px; font-weight: 700; color: var(--gray-800); }
.page-subtitle { font-size: 14px; color: var(--gray-500); margin-top: 4px; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.search-input { width: 280px; padding: 9px 14px 9px 38px; border: 1.5px solid var(--gray-300); border-radius: var(--radius); font-size: 14px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239CA3AF' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") 12px center no-repeat; }
.search-input:focus { outline: none; border-color: var(--primary); }
.filter-select { padding: 9px 14px; border: 1.5px solid var(--gray-300); border-radius: var(--radius); font-size: 14px; background: #fff; }

/* ===== AUTH PAGES ===== */
.auth-page { min-height: 100vh; display: flex; }
.auth-left { flex: 1; background: linear-gradient(135deg, var(--primary), #7C3AED); display: flex; align-items: center; justify-content: center; padding: 40px; color: #fff; }
.auth-left h2 { font-size: 36px; font-weight: 700; margin-bottom: 16px; }
.auth-left p { font-size: 18px; opacity: .9; }
.auth-left .features-list { margin-top: 32px; display: flex; flex-direction: column; gap: 16px; }
.auth-left .features-list li { display: flex; align-items: center; gap: 12px; font-size: 16px; }
.auth-right { width: 500px; display: flex; align-items: center; justify-content: center; padding: 40px; background: #fff; }
.auth-form { width: 100%; max-width: 400px; }
.auth-form h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.auth-form .subtitle { color: var(--gray-500); margin-bottom: 32px; }
.auth-divider { text-align: center; position: relative; margin: 24px 0; color: var(--gray-400); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ''; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--gray-200); }
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .hero-content { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid { grid-template-columns: 1fr; max-width: 400px; }
  .pricing-card.featured { transform: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  /* Prevent horizontal overflow */
  html, body { overflow-x: hidden; }

  .hero { padding: 120px 0 60px; }
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 15px; }
  .hero-actions { flex-direction: column; gap: 12px; }
  .hero-actions .btn { width: 100%; text-align: center; }
  .hero-stats { flex-direction: row; gap: 16px; justify-content: center; }
  .hero-stat .num { font-size: 24px; }
  .hero-stat .label { font-size: 12px; }
  .features-grid { grid-template-columns: 1fr; }
  .section-header h2 { font-size: 24px; }
  .section-header p { font-size: 15px; }

  /* Navbar: hide actions, show toggle */
  .nav-links { display: none; }
  .nav-actions { display: none; }
  .nav-mobile-toggle { display: block; }

  /* Mobile nav dropdown */
  .nav-links.show {
    display: flex; flex-direction: column; position: absolute;
    top: 72px; left: 0; right: 0; background: #fff; padding: 16px 24px;
    box-shadow: var(--shadow-lg); gap: 12px; z-index: 99;
  }

  /* Modules grid: override inline 4-col */
  #modulesGrid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }

  /* Service grid */
  #serviceGrid { grid-template-columns: 1fr !important; max-width: 400px !important; margin: 0 auto !important; }

  /* Billing toggle: wrap */
  .billing-toggle { padding: 6px 10px; font-size: 12px; }

  /* Pricing section */
  .pricing-grid { max-width: 100%; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }

  /* App layout */
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-toggle { display: block; }
  .auth-left { display: none; }
  .auth-right { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-input { width: 100%; }

  /* CTA section */
  .cta-section h2 { font-size: 24px; }
  .cta-section p { font-size: 15px; }

  /* Detail list */
  .detail-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .hero h1 { font-size: 24px; }
  .hero-stats { flex-direction: column; gap: 12px; }
  #modulesGrid { grid-template-columns: repeat(2, 1fr) !important; }
  .section { padding: 48px 0; }
  .section-header { margin-bottom: 32px; }
  .section-header h2 { font-size: 20px; }
  .btn-xl { padding: 14px 24px; font-size: 16px; }
}

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn .4s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.slide-up { animation: slideUp .5s ease; }
.delay-1 { animation-delay: .1s; animation-fill-mode: both; }
.delay-2 { animation-delay: .2s; animation-fill-mode: both; }
.delay-3 { animation-delay: .3s; animation-fill-mode: both; }
.delay-4 { animation-delay: .4s; animation-fill-mode: both; }

/* Status dots */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.active { background: var(--success); }
.status-dot.pending { background: var(--warning); }
.status-dot.inactive { background: var(--gray-300); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
.sidebar::-webkit-scrollbar-thumb { background: var(--gray-700); }

/* Chart container */
.chart-container { position: relative; height: 300px; }

/* Detail list */
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.detail-item { display: flex; flex-direction: column; }
.detail-label { font-size: 13px; color: var(--gray-500); }
.detail-value { font-size: 15px; font-weight: 500; }

/* Print styles */
@media print {
  .sidebar, .header, .page-header .btn, #widgetPanel, .toast-container { display: none !important; }
  .main-content { margin-left: 0 !important; padding: 0 !important; }
  .page-content { padding: 0 !important; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
  .kpi-card { box-shadow: none; border: 1px solid #ddd; }
  body { font-size: 12px; }
  .page-header { margin-bottom: 12px; }
  .page-title { font-size: 18px; }
}
