/* ==================== BASE ==================== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --bg: #f8fafc;
    --sidebar-bg: #1e1b4b;
    --sidebar-text: #c7d2fe;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', 'Segoe UI', 'Apple SD Gothic Neo', sans-serif; background: var(--bg); color: var(--text); }
a { text-decoration: none; color: inherit; }

/* ==================== LOGIN ==================== */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
}
.login-card {
    background: #fff; border-radius: 20px; padding: 48px 40px; width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-brand { text-align: center; margin-bottom: 36px; }
.login-icon {
    display: inline-flex; width: 64px; height: 64px; border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff; align-items: center; justify-content: center; font-size: 28px;
    margin-bottom: 16px;
}
.login-brand h1 { font-size: 24px; color: var(--text); font-weight: 800; }
.login-brand p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 12px 16px; border: 1.5px solid var(--border); border-radius: 10px;
    font-size: 14px; transition: border-color .2s; font-family: inherit; background: #fff;
}
.form-group input:focus, .form-group select:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.error-msg { color: var(--danger); font-size: 13px; margin-bottom: 12px; padding: 8px 12px; background: #fef2f2; border-radius: 8px; }

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px;
    border-radius: 10px; border: none; cursor: pointer; font-size: 14px;
    font-weight: 600; font-family: inherit; transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.btn-success { background: var(--success); color:#fff; }
.btn-success:hover { background: #059669; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-full { width: 100%; justify-content: center; padding: 14px; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.text-danger { color: var(--danger) !important; }

/* ==================== LAYOUT ==================== */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 240px; background: var(--sidebar-bg); display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
}
.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 18px;
}
.brand-name { color: #fff; font-weight: 800; font-size: 16px; }
.brand-sub { color: var(--sidebar-text); font-size: 11px; opacity: .7; }

.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 11px 16px;
    border-radius: 10px; color: var(--sidebar-text); font-size: 14px;
    font-weight: 500; transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(99,102,241,.3); color: #fff; font-weight: 600; }
.nav-item i { width: 20px; text-align: center; font-size: 15px; }

.sidebar-footer {
    padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; justify-content: space-between;
}
.user-info { display: flex; align-items: center; gap: 8px; color: var(--sidebar-text); font-size: 13px; }
.btn-logout { background: none; border: none; color: var(--sidebar-text); cursor: pointer; padding: 6px; border-radius: 6px; }
.btn-logout:hover { background: rgba(255,255,255,.1); color: #fff; }

/* Main Content */
.main-content { flex: 1; margin-left: 240px; padding: 24px 32px; min-height: 100vh; min-width: 0; overflow-x: hidden; }

/* Page Header */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 24px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 10px; }
.page-header h1 i { color: var(--primary); }
.page-header p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.header-actions { display: flex; gap: 8px; }

/* ==================== STATS ==================== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--card-bg); border-radius: var(--radius); padding: 24px;
    display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
    border-left: 4px solid var(--accent, var(--primary));
}
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); font-size: 20px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ==================== CARDS ==================== */
.section-card {
    background: var(--card-bg); border-radius: var(--radius); padding: 24px;
    box-shadow: var(--shadow); margin-bottom: 24px;
}
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-header h2 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-header h2 i { color: var(--primary); font-size: 16px; }

/* ==================== TABLE ==================== */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 10px 16px; font-size: 12px; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
    border-bottom: 2px solid var(--border);
}
.data-table td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover { background: #f8faff; }

/* Subscriber table column widths */
.sub-table { table-layout: fixed; width: 100%; }
.sub-table th, .sub-table td { overflow: hidden; text-overflow: ellipsis; }
.sub-table th:nth-child(1), .sub-table td:nth-child(1) { width: 6%; white-space: nowrap; }    /* 이름 */
.sub-table th:nth-child(2), .sub-table td:nth-child(2) { width: 15%; white-space: nowrap; }   /* 이메일 */
.sub-table th:nth-child(3), .sub-table td:nth-child(3) { width: 9%; white-space: nowrap; }    /* 회사 */
.sub-table th:nth-child(4), .sub-table td:nth-child(4) { width: 8%; white-space: nowrap; }    /* 부서/직급 */
.sub-table th:nth-child(5), .sub-table td:nth-child(5) { width: 4%; text-align: center; }     /* 지역 */
.sub-table th:nth-child(6), .sub-table td:nth-child(6) { width: 24%; }                        /* 관심 분야 */
.sub-table th:nth-child(7), .sub-table td:nth-child(7) { width: 10%; }                        /* 그룹 */
.sub-table th:nth-child(8), .sub-table td:nth-child(8) { width: 5%; text-align: center; }     /* 상태 */
.sub-table th:nth-child(9), .sub-table td:nth-child(9) { width: 7%; }                         /* 액션 */
.sub-table td:nth-child(6) .tag,
.sub-table td:nth-child(7) .tag { font-size: 10px; padding: 1px 6px; }
.sub-table th, .sub-table td { padding: 10px 8px; }

.nl-title { font-weight: 600; color: var(--text); }
.nl-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.empty-state { text-align: center; padding: 40px !important; color: var(--text-muted); }
.action-group { display: flex; gap: 4px; }

/* Badges */
.badge {
    display: inline-flex; padding: 3px 10px; border-radius: 20px; font-size: 11px;
    font-weight: 600; letter-spacing: .3px;
}
.badge-draft { background: #f1f5f9; color: #64748b; }
.badge-ready { background: #ecfdf5; color: #059669; }
.badge-sent { background: #eff6ff; color: #2563eb; }
.badge-scheduled { background: #fef3c7; color: #d97706; }
.badge-ai { background: #eef2ff; color: #6366f1; }

.tag { display: inline-block; padding: 2px 8px; background: #f1f5f9; border-radius: 4px; font-size: 11px; margin: 1px; color: var(--text-muted); white-space: nowrap; }

/* ==================== QUICK ACTIONS ==================== */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.action-btn {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 24px 16px; border-radius: 12px; font-size: 14px; font-weight: 600;
    transition: all .2s; text-align: center;
}
.action-btn i { font-size: 24px; }
.action-generate { background: linear-gradient(135deg, #eef2ff, #e0e7ff); color: var(--primary); }
.action-generate:hover { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); transform: translateY(-2px); }
.action-list { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #059669; }
.action-list:hover { background: linear-gradient(135deg, #d1fae5, #a7f3d0); transform: translateY(-2px); }
.action-sub { background: linear-gradient(135deg, #eff6ff, #dbeafe); color: #2563eb; }
.action-sub:hover { background: linear-gradient(135deg, #dbeafe, #bfdbfe); transform: translateY(-2px); }
.action-settings { background: linear-gradient(135deg, #fefce8, #fef3c7); color: #d97706; }
.action-settings:hover { background: linear-gradient(135deg, #fef3c7, #fde68a); transform: translateY(-2px); }

/* ==================== NEWSLETTER GRID ==================== */
.newsletter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; align-items: stretch; }
.newsletter-card {
    background: var(--card-bg); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); transition: all .2s;
    display: flex; flex-direction: column; height: 100%;
}
.newsletter-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.nl-card-thumb {
    height: 180px; background-size: cover; background-position: center;
    position: relative;
}
.nl-card-thumb-gradient {
    display: flex; align-items: center; justify-content: center;
}
.nl-thumb-icon {
    width: 64px; height: 64px; border-radius: 16px;
    background: rgba(255,255,255,.2); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: rgba(255,255,255,.9);
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.nl-card-overlay {
    position: absolute; top: 12px; left: 12px; display: flex; gap: 6px;
}
.nl-card-body { padding: 20px; flex: 1 1 auto; display: flex; flex-direction: column; }
.nl-card-cat { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.nl-card-body h3 { font-size: 17px; font-weight: 700; margin: 8px 0; line-height: 1.4; }
.nl-card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nl-card-meta { display: flex; gap: 16px; margin-top: auto; padding-top: 12px; font-size: 12px; color: var(--text-muted); }
.nl-card-meta i { margin-right: 4px; }
.nl-card-actions {
    display: flex; gap: 4px; padding: 12px 20px; border-top: 1px solid var(--border);
    margin-top: auto;
}

.empty-state-large {
    text-align: center; padding: 80px 20px; grid-column: 1 / -1;
}
.empty-state-large i { font-size: 48px; color: var(--primary-light); margin-bottom: 16px; }
.empty-state-large h3 { font-size: 20px; color: var(--text); margin-bottom: 8px; }
.empty-state-large p { color: var(--text-muted); margin-bottom: 20px; }

/* ==================== MODAL ==================== */
.modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5); z-index: 1000; display: flex;
    align-items: center; justify-content: center;
}
.modal-content {
    background: #fff; border-radius: 16px; width: 520px; max-width: 90%;
    max-height: 90vh; overflow-y: auto; padding: 28px;
}
.modal-sm { width: 420px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-header h3 { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; font-size: 24px; color: var(--text-muted); cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: var(--bg); }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.modal-body { margin-bottom: 8px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid-5 { grid-template-columns: repeat(5, 1fr); }
.form-group.compact { margin-bottom: 8px; }
.form-group.compact label { margin-bottom: 4px; }
.form-group.compact input,
.form-group.compact select,
.form-group.compact textarea { padding: 7px 10px; font-size: 13px; }

/* Subscriber modal sections */
.sub-modal-section { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.sub-modal-section-title { font-size: 12px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.sub-modal-section-title i { margin-right: 4px; }

/* Chip selector for categories/groups */
.chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.chip-label { cursor: pointer; }
.chip-label input[type="checkbox"] { display: none; }
.chip-item { display: flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; background: #fff; border: 1.5px solid #e5e7eb; transition: all .15s; white-space: nowrap; }
.chip-icon { font-size: 13px; }
.chip-label input:checked + .chip-item { background: color-mix(in srgb, var(--chip-color) 12%, white); border-color: var(--chip-color); color: var(--chip-color); font-weight: 600; box-shadow: 0 0 0 1px var(--chip-color); }
.chip-item:hover { border-color: #a5b4fc; background: #f5f7ff; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--bg); border-radius: 8px; font-size: 13px; cursor: pointer; }
.checkbox-label:hover { background: #eef2ff; }

/* Group Management Modal */
.gm-tabs { display: flex; gap: 0; border-bottom: 2px solid #e5e7eb; margin-bottom: 16px; padding: 0; }
.gm-tab { background: none; border: none; padding: 11px 22px; font-size: 13px; font-weight: 600; color: #9ca3af; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.gm-tab:hover { color: #6366f1; background: #f5f3ff; }
.gm-tab-active { color: #6366f1; border-bottom-color: #6366f1; }
.gm-select { padding: 7px 12px; border: 1.5px solid #e5e7eb; border-radius: 8px; font-size: 13px; font-weight: 500; background: #fff; cursor: pointer; }
.gm-select:focus { border-color: #6366f1; outline: none; }

.gm-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; overflow: hidden; }
.gm-toolbar-divider { width: 1px; height: 24px; background: #e5e7eb; flex-shrink: 0; }
.gm-search-box { display: flex; gap: 6px; flex: 1; min-width: 200px; }
.gm-search-box input { flex: 1; padding: 7px 12px; border: 1.5px solid #e5e7eb; border-radius: 8px; font-size: 13px; }
.gm-search-box input:focus { border-color: #6366f1; outline: none; }
.gm-filter-input { padding: 7px 10px; border: 1.5px solid #e5e7eb; border-radius: 8px; font-size: 12px; flex-shrink: 0; }
.gm-filter-input:focus { border-color: #6366f1; outline: none; }
.gm-filter-select { padding: 7px 6px; border: 1.5px solid #e5e7eb; border-radius: 8px; font-size: 12px; background: #fff; cursor: pointer; flex-shrink: 0; }
.gm-filter-select:focus { border-color: #6366f1; outline: none; }
.gm-badge { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; color: #6366f1; background: #eef2ff; white-space: nowrap; }
.gm-check-label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #6b7280; cursor: pointer; white-space: nowrap; }

.gm-table-header { display: flex; align-items: center; gap: 0; padding: 8px 12px; background: #f8fafc; border-radius: 8px 8px 0 0; border: 1px solid #e5e7eb; border-bottom: none; font-size: 11px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .3px; }
.gm-table-header > span { padding: 0 6px; box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gm-list-area { border: 1px solid #e5e7eb; border-radius: 0 0 8px 8px; min-height: 120px; max-height: 400px; overflow-y: auto; overflow-x: hidden; }
.gm-row { display: flex; align-items: center; gap: 0; padding: 9px 12px; border-bottom: 1px solid #f3f4f6; font-size: 13px; transition: background .08s; }
.gm-row:last-child { border-bottom: none; }
.gm-row:hover { background: #f8f7ff; }
.gm-row-selectable { cursor: pointer; }
.gm-row-selectable:hover { background: #eef2ff; }

.gm-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; box-sizing: border-box; }
.gm-col-num { width: 30px; color: #9ca3af; font-size: 11px; text-align: center; flex-shrink: 0; }
.gm-col-check { width: 30px; text-align: center; flex-shrink: 0; }
.gm-col-name { width: 80px; flex-shrink: 0; font-weight: 600; color: #111827; }
.gm-col-email { flex: 2; min-width: 0; color: #6366f1; }
.gm-col-company { flex: 1.5; min-width: 0; color: #6b7280; }
.gm-col-age { width: 55px; text-align: center; color: #6b7280; flex-shrink: 0; }
.gm-col-gender { width: 45px; text-align: center; color: #6b7280; flex-shrink: 0; }
.gm-col-region { width: 55px; text-align: center; color: #6b7280; flex-shrink: 0; }
.gm-col-action { width: 36px; text-align: right; flex-shrink: 0; }

.gm-remove-btn { background: none; border: none; color: #ef4444; cursor: pointer; padding: 4px 6px; border-radius: 6px; font-size: 13px; transition: background .1s; }
.gm-remove-btn:hover { background: #fef2f2; }

.gm-pagination { display: flex; align-items: center; justify-content: space-between; padding: 10px 4px 2px; gap: 12px; }
.gm-page-info { font-size: 12px; color: #9ca3af; min-width: 100px; }
.gm-page-nav { display: flex; align-items: center; gap: 8px; }
.gm-page-btn { background: #f9fafb; border: 1px solid #e5e7eb; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #6366f1; font-size: 12px; transition: all .1s; }
.gm-page-btn:hover:not(:disabled) { background: #eef2ff; border-color: #6366f1; }
.gm-page-btn:disabled { color: #d1d5db; cursor: default; }
.gm-page-num { font-size: 12px; font-weight: 600; color: #374151; min-width: 50px; text-align: center; }
.gm-page-size select { padding: 5px 8px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 12px; background: #fff; cursor: pointer; }

.gm-action-bar { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; margin-top: 4px; border-top: 1px solid #f3f4f6; }

.gm-empty { text-align: center; padding: 32px 0; color: #9ca3af; font-size: 13px; }

/* ==================== GENERATE ==================== */
.generate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 24px; }
.category-card input[type="radio"] { display: none; }
.category-card-inner {
    padding: 20px; border-radius: 12px; border: 2px solid var(--border);
    cursor: pointer; transition: all .2s; background: #fff;
}
.category-card input:checked + .category-card-inner {
    border-color: var(--cat-color); background: color-mix(in srgb, var(--cat-color) 5%, white);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat-color) 15%, transparent);
}
.category-card-inner:hover { border-color: var(--cat-color); }
.cat-icon { font-size: 28px; margin-bottom: 8px; }
.cat-name { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.cat-desc { font-size: 13px; color: var(--text-muted); line-height: 1.4; }
.cat-keywords { font-size: 11px; color: var(--primary-light); margin-top: 8px; }
.generate-actions { text-align: center; padding-top: 8px; }

.generation-progress { text-align: center; padding: 40px 20px; }
.progress-spinner { margin-bottom: 16px; color: var(--primary); }
.progress-bar { width: 100%; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 16px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #8b5cf6); border-radius: 3px; width: 0; transition: width .3s; }

.generation-result { text-align: center; padding: 40px 20px; }
.result-icon { margin-bottom: 16px; }
.result-actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }

/* LLM Status */
.llm-status { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.status-indicator {
    display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
    padding: 4px 12px; border-radius: 20px;
}
.status-connected { color: var(--success); background: #ecfdf5; }
.status-connected i { font-size: 8px; }
.status-disconnected { color: var(--danger); background: #fef2f2; }
.status-disconnected i { font-size: 8px; }
.status-detail { display: flex; gap: 16px; font-size: 13px; color: var(--text-muted); }

/* ==================== SETTINGS ==================== */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ==================== PREVIEW ==================== */
.preview-container { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.preview-toolbar {
    display: flex; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.preview-btn {
    padding: 6px 16px; border-radius: 8px; border: 1px solid var(--border);
    background: #fff; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.preview-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.preview-frame-wrapper { display: flex; justify-content: center; padding: 20px; background: #e2e8f0; min-height: 600px; }
.preview-frame {
    width: 100%; max-width: 100%; border: none; background: #fff;
    border-radius: 8px; box-shadow: 0 4px 24px rgba(0,0,0,.1);
    min-height: 800px; transition: max-width .3s;
}

/* ==================== DASHBOARD MODERN ==================== */
.stats-grid-6 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat-card-modern {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, white), color-mix(in srgb, var(--accent) 3%, white));
    border: 1px solid color-mix(in srgb, var(--accent) 15%, transparent);
}
.stat-card-modern .stat-icon-wrap {
    width: 48px; height: 48px; border-radius: 12px;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: var(--accent);
}
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.chart-card { margin-bottom: 0; }
.chart-container { position: relative; height: 280px; }
.compact-table { font-size: 0.88rem; }
.compact-table th { font-size: 0.78rem; }
.ellipsis-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-actions { display: flex; gap: 8px; }

/* Badges for campaign statuses */
.badge-sent { background: #ecfdf5; color: #059669; }
.badge-sending { background: #eff6ff; color: #2563eb; }
.badge-cancelled { background: #fef2f2; color: #dc2626; }
.badge-scheduled { background: #fffbeb; color: #d97706; }
.badge-info { background: #f0f4ff; color: #6366f1; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid-6 { grid-template-columns: repeat(3, 1fr); }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .settings-grid { grid-template-columns: 1fr; }
    .chart-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .brand-name, .sidebar .brand-sub, .sidebar .nav-item span, .sidebar .user-info span { display: none; }
    .main-content { margin-left: 60px; padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stats-grid-6 { grid-template-columns: repeat(2, 1fr); }
    .chart-row { grid-template-columns: 1fr; }
}

/* ==================== PAGINATION & SEARCH BAR ==================== */
.list-toolbar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-bottom: 16px; padding: 14px 20px;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
}
.list-toolbar .search-box {
    flex: 1; min-width: 180px; position: relative;
}
.list-toolbar .search-box input {
    width: 100%; padding: 9px 14px 9px 36px; border: 1.5px solid #e5e7eb;
    border-radius: 8px; font-size: .88rem; font-family: inherit;
    transition: border-color .2s;
}
.list-toolbar .search-box input:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.list-toolbar .search-box i {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: #9ca3af; font-size: .88rem;
}
.list-toolbar select {
    padding: 9px 12px; border: 1.5px solid #e5e7eb; border-radius: 8px;
    font-size: .85rem; font-family: inherit; background: #fff; cursor: pointer;
}
.list-toolbar select:focus { outline: none; border-color: var(--primary); }
.list-toolbar .toolbar-btn {
    padding: 9px 14px; border: 1.5px solid #e5e7eb; border-radius: 8px;
    background: #fff; cursor: pointer; font-size: .85rem; color: #6b7280;
    display: flex; align-items: center; gap: 5px; font-family: inherit;
    transition: all .15s;
}
.list-toolbar .toolbar-btn:hover { border-color: var(--primary); color: var(--primary); }

.list-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 16px; padding: 12px 0; flex-wrap: wrap; gap: 12px;
}
.list-footer-left {
    display: flex; align-items: center; gap: 10px; font-size: .85rem; color: #6b7280;
}
.list-footer-left select {
    padding: 5px 8px; border: 1.5px solid #e5e7eb; border-radius: 6px;
    font-size: .85rem; font-family: inherit; background: #fff;
}
.pg-controls {
    display: flex; align-items: center; gap: 4px;
}
.pg-btn {
    min-width: 34px; height: 34px; border-radius: 8px; border: 1px solid #e5e7eb;
    background: #fff; cursor: pointer; font-size: .85rem; font-weight: 600;
    color: #374151; display: inline-flex; align-items: center; justify-content: center;
    transition: all .15s; font-family: inherit;
}
.pg-btn:hover:not(.pg-disabled):not(.pg-active) { border-color: var(--primary); color: var(--primary); background: #f0f0ff; }
.pg-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pg-disabled { opacity: .35; cursor: default; }
.pg-ellipsis { padding: 0 4px; color: #9ca3af; font-size: .85rem; }
.page-info { font-size: .85rem; color: #6b7280; font-weight: 500; }
