/* admin.css */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
body { background-color: #F8F9FA; color: #1F2937; display: flex; height: 100vh; overflow: hidden; }
a { text-decoration: none; color: inherit; }

/* Sidebar */
.sidebar { width: 260px; background: #111827; color: #F3F4F6; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 24px; border-bottom: 1px solid #374151; }
.sidebar-logo { display: flex; align-items: center; gap: 12px; }
.sidebar-brand { font-weight: 700; font-size: 1.2rem; margin-bottom: 4px; }
.sidebar-client { font-size: 0.8rem; color: #9CA3AF; }
.sidebar-nav { flex: 1; padding: 24px 16px; overflow-y: auto; }
.nav-section-label { font-size: 0.75rem; text-transform: uppercase; color: #6B7280; font-weight: 600; margin-bottom: 12px; padding-left: 8px; display: flex; align-items: center; gap: 8px; }
.pro-badge { background: #C9A96E; color: #111827; padding: 2px 6px; border-radius: 4px; font-size: 0.6rem; font-weight: 700; }

.sidebar-link { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; margin-bottom: 4px; transition: 0.2s; font-size: 0.9rem; color: #D1D5DB; cursor: pointer; }
.sidebar-link:hover { background: #374151; color: #FFF; }
.sidebar-link.active { background: #C9A96E; color: #111827; font-weight: 600; }
.lock-icon { margin-left: auto; color: #9CA3AF; }
.sidebar-footer { padding: 24px; border-top: 1px solid #374151; }
.view-site-link { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: #9CA3AF; transition: 0.2s; }
.view-site-link:hover { color: #FFF; }

/* Main */
.admin-main { flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.admin-topbar { height: 70px; background: #FFF; border-bottom: 1px solid #E5E7EB; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; flex-shrink:0; }
.topbar-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle { display: none; background: none; border: none; cursor: pointer; }
.topbar-title { font-size: 1.25rem; font-weight: 600; }
.topbar-avatar { width: 36px; height: 36px; border-radius: 50%; background: #C9A96E; color: #111827; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; }

/* Content */
.tab-content { display: none; padding: 32px; overflow-y: auto; height: calc(100vh - 70px); }
.tab-content.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Stats */
.analytics-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; margin-bottom: 32px; }
.stat-widget { background: #FFF; padding: 24px; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid #F3F4F6; }
.sw-label { font-size: 0.85rem; color: #6B7280; font-weight: 500; margin-bottom: 8px; }
.sw-value { font-size: 2rem; font-family: 'Cormorant Garamond', serif; font-weight: 600; color: #111827; margin-bottom: 8px; }
.sw-change { font-size: 0.8rem; font-weight: 500; }
.sw-change.positive { color: #10B981; }

/* Charts Area */
.analytics-charts { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 32px; }
.chart-card { background: #FFF; padding: 24px; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid #F3F4F6; }
.chart-title { font-weight: 600; font-size: 1.1rem; margin-bottom: 24px; color: #1F2937; }
.chart-bar-group { display: flex; flex-direction: column; gap: 12px; }
.chart-bar-row { display: flex; align-items: center; gap: 12px; font-size: 0.85rem; }
.bar-label { width: 40px; color: #6B7280; }
.bar-wrap { flex: 1; height: 8px; background: #F3F4F6; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: #C9A96E; border-radius: 4px; }
.bar-val { width: 40px; text-align: right; color: #374151; font-weight: 500; }
.source-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.source-item { display: flex; align-items: center; font-size: 0.9rem; }
.source-dot { width: 10px; height: 10px; border-radius: 50%; margin-right: 12px; }
.source-name { flex: 1; color: #374151; }
.source-pct { font-weight: 600; }
.source-bar-visual { display: flex; height: 12px; width: 100%; border-radius: 6px; overflow: hidden; }

/* Recent */
.recent-activity { background: #FFF; padding: 24px; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid #F3F4F6; }
.activity-table { display: flex; flex-direction: column; width: 100%; }
.table-header { display: grid; grid-template-columns: 2fr 2fr 1fr 1fr; padding-bottom: 12px; font-weight: 600; font-size: 0.85rem; color: #6B7280; border-bottom: 1px solid #E5E7EB; }
.table-row { display: grid; grid-template-columns: 2fr 2fr 1fr 1fr; padding: 16px 0; border-bottom: 1px solid #F3F4F6; font-size: 0.9rem; align-items: center; }
.table-row:last-child { border-bottom: none; }
.status-badge { padding: 4px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; display: inline-block; text-align: center; }
.status-badge.new { background: #E0E7FF; color: #1D4ED8; }
.status-badge.replied { background: #FEF3C7; color: #B45309; }
.status-badge.closed { background: #D1FAE5; color: #065F46; }

/* Editor */
.editor-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.editor-panel { background: #FFF; padding: 32px; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.editor-section-label { font-weight: 700; margin-bottom: 16px; color: #111827; }
.form-group-admin { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.form-group-admin label { font-size: 0.85rem; font-weight: 600; color: #374151; }
.admin-input { padding: 12px; border: 1px solid #D1D5DB; border-radius: 6px; font-size: 0.95rem; font-family: 'Inter', sans-serif; resize: vertical; }
.admin-input:focus { outline: none; border-color: #C9A96E; box-shadow: 0 0 0 2px rgba(201,169,110,0.2); }
.field-hint { font-size: 0.75rem; color: #6B7280; }
.admin-btn-primary { background: #111827; color: #FFF; padding: 12px 24px; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.admin-btn-primary:hover { background: #1F2937; }
.editor-preview { background: #F3F4F6; padding: 32px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.editor-preview-label { font-weight: 600; color: #6B7280; margin-bottom: 16px; }
.preview-card { background: #FFF; padding: 40px; border-radius: 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); text-align: center; max-width: 400px; }
.preview-eyebrow { font-size: 0.75rem; text-transform: uppercase; color: #C9A96E; font-weight: 600; margin-bottom: 12px; }
.preview-headline { font-family: 'Cormorant Garamond', serif; font-size: 2rem; color: #111827; margin-bottom: 16px; line-height: 1.1; }
.preview-body { font-size: 0.9rem; color: #6B7280; margin-bottom: 24px; }
.preview-btn { background: #111827; color: #FFF; padding: 12px 24px; border-radius: 100px; font-size: 0.85rem; font-weight: 600; display: inline-block; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.settings-card { background: #FFF; padding: 24px; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.settings-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.settings-card-header h3 { font-size: 1.1rem; font-weight: 600; color: #111827; }
.settings-desc { font-size: 0.85rem; color: #6B7280; margin-bottom: 20px; line-height: 1.5; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; font-size: 0.95rem; font-weight: 500; }
.toggle-input { display: none; }
.toggle-label { width: 44px; height: 24px; background: #E5E7EB; border-radius: 12px; position: relative; cursor: pointer; transition: 0.3s; display: block; }
.toggle-label::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #FFF; border-radius: 50%; transition: 0.3s; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.toggle-input:checked + .toggle-label { background: #10B981; }
.toggle-input:checked + .toggle-label::after { transform: translateX(20px); }

/* Toasts */
.save-toast { display: block; background: #10B981; color: #FFF; padding: 12px 16px; border-radius: 6px; font-size: 0.9rem; font-weight: 600; margin-top: 16px; opacity: 0; transform: translateY(10px); transition: 0.3s; pointer-events: none; }
.save-toast.show { opacity: 1; transform: translateY(0); }

/* Locked Tabs */
.locked-tab { display: flex; gap: 32px; position: relative; }
.locked-content { flex: 1; background: #FFF; padding: 40px; border-radius: 12px; border: 1px solid #E5E7EB; max-width: 500px; z-index: 2; position: relative; }
.locked-icon { font-size: 3rem; margin-bottom: 20px; }
.locked-title { font-size: 1.8rem; font-family: 'Cormorant Garamond', serif; font-weight: 600; margin-bottom: 16px; }
.locked-body { color: #4B5563; line-height: 1.6; margin-bottom: 24px; }
.locked-features { display: flex; flex-direction: column; gap: 12px; margin-bottom: 32px; }
.lf-item { font-size: 0.9rem; font-weight: 500; color: #111827; }
.upgrade-btn { background: #C9A96E; color: #111827; padding: 14px 28px; border: none; border-radius: 8px; font-weight: 700; cursor: pointer; transition: 0.2s; width: 100%; font-size: 1rem; }
.upgrade-btn:hover { background: #B69255; }
.locked-preview-blur { flex: 1; filter: blur(5px); opacity: 0.4; pointer-events: none; user-select: none; }
.blur-table { background: #FFF; padding: 24px; border-radius: 12px; border: 1px solid #E5E7EB; }
.bt-header { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; padding-bottom: 12px; font-weight: 600; font-size: 0.85rem; border-bottom: 1px solid #E5E7EB; }
.bt-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; padding: 16px 0; border-bottom: 1px solid #F3F4F6; font-size: 0.9rem; }
.bt-chip { background: #E5E7EB; padding: 4px 8px; border-radius: 12px; font-size: 0.75rem; text-align: center; }

/* Modal */
.pro-modal-overlay { position: fixed; inset: 0; background: rgba(17,24,39,0.7); backdrop-filter: blur(4px); z-index: 999; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: 0.3s; }
.pro-modal-overlay.visible { opacity: 1; pointer-events: all; }
.pro-modal { background: #FFF; width: 90%; max-width: 440px; padding: 40px; border-radius: 16px; text-align: center; position: relative; transform: scale(0.95); transition: 0.3s; }
.pro-modal-overlay.visible .pro-modal { transform: scale(1); }
.pro-modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 1.25rem; color: #9CA3AF; cursor: pointer; }
.pro-modal-icon { width: 80px; height: 80px; background: rgba(201,169,110,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; }
.pro-modal-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 16px; color: #111827; }
.pro-modal-body { color: #6B7280; margin-bottom: 24px; line-height: 1.6; }
.pro-modal-features { text-align: left; display: inline-flex; flex-direction: column; gap: 12px; margin-bottom: 32px; background: #F9FAFB; padding: 20px; border-radius: 12px; width: 100%; border: 1px solid #F3F4F6; }
.pmf-item { font-size: 0.9rem; font-weight: 500; color: #374151; }
.pro-modal-cta { display: block; background: #C9A96E; color: #111827; padding: 14px; border-radius: 8px; font-weight: 700; margin-bottom: 16px; transition: 0.2s; }
.pro-modal-cta:hover { background: #B69255; }
.pro-modal-footnote { font-size: 0.75rem; color: #9CA3AF; }

/* Responsive Mobile */
@media (max-width: 768px) {
  .sidebar { position: fixed; inset: 0; z-index: 100; transform: translateX(-100%); transition: 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; color: #111827; }
  .admin-topbar { padding: 0 16px; }
  .tab-content { padding: 16px; height: calc(100vh - 70px); }
  .analytics-charts { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
  .locked-tab { flex-direction: column; gap: 24px; }
  .locked-preview-blur { display: none; }
  .table-header, .table-row { grid-template-columns: 1.5fr 1.5fr 1fr; }
  .table-header span:last-child, .table-row span:last-child { display: none; }
}
