*{box-sizing:border-box}body{margin:0;font-family:Arial,Helvetica,sans-serif;background:#f4f6f8;color:#1f2937}.app{display:flex;min-height:100vh}.sidebar{width:240px;background:#111827;color:#fff;padding:22px 16px;position:fixed;top:0;bottom:0}.brand{font-size:22px;font-weight:700;margin-bottom:24px}.sidebar a{display:block;color:#d1d5db;text-decoration:none;padding:11px 12px;border-radius:8px;margin-bottom:4px}.sidebar a:hover{background:#1f2937;color:#fff}.main{margin-left:240px;padding:24px;width:calc(100% - 240px)}.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.topbar h1{font-size:24px;margin:0}.user{color:#6b7280}.card{background:#fff;border-radius:12px;padding:18px;margin-bottom:16px;box-shadow:0 1px 3px rgba(0,0,0,.08)}.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}.stat{font-size:28px;font-weight:700}.muted{color:#6b7280}.btn{display:inline-block;background:#2563eb;color:#fff!important;border:0;border-radius:8px;padding:9px 13px;text-decoration:none;cursor:pointer;font-size:14px}.btn.secondary{background:#6b7280}.btn.danger{background:#dc2626}.btn.success{background:#16a34a}.btn.small{padding:6px 9px;font-size:12px}input,select,textarea{width:100%;padding:10px 11px;border:1px solid #d1d5db;border-radius:8px;margin:6px 0 12px;background:#fff}textarea{min-height:140px}label{font-weight:600;font-size:14px}table{width:100%;border-collapse:collapse;background:#fff;border-radius:12px;overflow:hidden}th,td{padding:10px;border-bottom:1px solid #e5e7eb;text-align:left;vertical-align:top}th{background:#f9fafb}.actions a,.actions button{margin-right:6px}.alert{padding:12px 14px;border-radius:8px;margin-bottom:14px}.alert-success{background:#dcfce7;color:#166534}.alert-error{background:#fee2e2;color:#991b1b}.alert-info{background:#dbeafe;color:#1e40af}.badge{display:inline-block;padding:4px 8px;border-radius:999px;font-size:12px;background:#e5e7eb}.badge-sent,.badge-active,.badge-done{background:#dcfce7;color:#166534}.badge-error,.badge-inactive{background:#fee2e2;color:#991b1b}.badge-pending,.badge-running{background:#fef3c7;color:#92400e}.login-wrap{max-width:420px;margin:80px auto}.two{display:grid;grid-template-columns:1fr 1fr;gap:14px}.three{display:grid;grid-template-columns:1fr 1fr 1fr;gap:14px}.checklist{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:8px 0 14px}.checkitem{background:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;padding:8px}.checkitem input{width:auto;margin-right:6px}@media(max-width:900px){.sidebar{position:static;width:100%;height:auto}.app{display:block}.main{margin-left:0;width:100%}.grid,.two,.three,.checklist{grid-template-columns:1fr}.topbar{display:block}}

.editor-wrap{border:1px solid #d1d5db;border-radius:10px;margin:6px 0 12px;background:#fff;overflow:visible}.editor-toolbar,.variable-toolbar{display:flex;flex-wrap:wrap;gap:6px;padding:8px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.editor-toolbar button,.variable-toolbar button{width:auto;margin:0;padding:6px 9px;border:1px solid #d1d5db;border-radius:7px;background:#fff;cursor:pointer;font-size:13px}.editor-toolbar button:hover,.variable-toolbar button:hover{background:#eef2ff;border-color:#93c5fd}.variable-toolbar span{font-size:13px;color:#6b7280;align-self:center;margin-right:4px}.email-editor{min-height:300px;max-height:80vh;padding:14px;margin:10px;border:1px solid #9ca3af;border-radius:9px;outline:none;line-height:1.6;background:#fff;resize:vertical;overflow:auto}.email-editor:focus{border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.16)}.email-editor p{margin:0 0 12px}.email-editor ul,.email-editor ol{margin-top:0}
.email-editor.dragover{border-color:#16a34a;box-shadow:0 0 0 3px rgba(22,163,74,.18);background:#f0fdf4}.email-editor.uploading{cursor:progress}.email-editor img,.email-editor .email-inline-image{max-width:100%;height:auto;display:inline-block;margin:6px 0;border-radius:6px}.editor-hint{font-size:12px;color:#6b7280;padding:0 12px 12px}.editor-wrap input[type=file]{display:none}


/* Resize handle chắc chắn cho khung soạn thảo */
.email-editor{resize:none!important;height:360px;max-height:none!important;}
.editor-resizer{margin:0 10px 8px;padding:8px 10px;border:1px dashed #9ca3af;border-radius:8px;background:#f9fafb;color:#4b5563;text-align:center;font-size:13px;cursor:ns-resize;user-select:none;touch-action:none;}
.editor-resizer:hover{background:#eef2ff;border-color:#2563eb;color:#1d4ed8;}
body.editor-resizing{cursor:ns-resize!important;user-select:none;}
body.editor-resizing *{cursor:ns-resize!important;}

.schedule-box{margin:22px 0;padding:18px;border:1px solid #cbd5e1;border-radius:10px;background:#f8fafc}
.schedule-box h3{margin-top:0;margin-bottom:14px}
.three{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.list-tabs{display:flex;flex-wrap:wrap;gap:10px}
.list-tab{display:flex;flex-direction:column;gap:3px;min-width:180px;padding:12px 14px;border:1px solid #cbd5e1;border-radius:9px;text-decoration:none;color:inherit;background:#fff}
.list-tab span{font-size:13px;color:#64748b}
.list-tab.active{border-color:#2563eb;box-shadow:0 0 0 2px rgba(37,99,235,.12);background:#eff6ff}
@media(max-width:760px){.three{grid-template-columns:1fr}.list-tab{width:100%}}
