
:root{--bg:#f4f7fb;--card:#fff;--text:#14213d;--muted:#64748b;--line:#e5eaf2;--blue:#2563eb;--blue-dark:#1d4ed8;--green:#15803d;--green-bg:#dcfce7;--amber:#b45309;--amber-bg:#fef3c7;--red:#dc2626;--red-bg:#fee2e2}
*{box-sizing:border-box}html,body{max-width:100%;overflow-x:hidden}body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif}button,input,select{font:inherit}button{border:0;cursor:pointer}button:disabled{opacity:.55;cursor:not-allowed}.wrap{width:100%;max-width:1480px;margin:auto;padding:24px}.card{min-width:0;background:var(--card);border:1px solid var(--line);border-radius:18px;padding:22px;margin-bottom:18px;box-shadow:0 5px 20px rgba(15,31,75,.045)}.hidden{display:none!important}.muted{color:var(--muted);font-size:13px}h1,h2,h3{margin:0 0 6px;letter-spacing:-.02em}h1{font-size:27px}h2{font-size:20px}h3{font-size:16px}
.brand{display:flex;align-items:center;gap:12px;min-width:0}.brand-mark{width:42px;height:42px;flex:0 0 42px;border-radius:12px;background:linear-gradient(135deg,#0b2a75,#1688ff);display:grid;place-items:center;color:#fff;box-shadow:0 5px 14px rgba(37,99,235,.22)}.brand-mark svg{width:25px;height:25px}.brand-sub{color:var(--muted);font-size:13px;margin-top:2px}.header{display:flex;justify-content:space-between;align-items:center;gap:18px;flex-wrap:wrap;min-width:0}.header-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:40px;padding:9px 13px;border-radius:10px;background:var(--blue);color:#fff;font-weight:650;transition:.15s ease}.btn:hover{background:var(--blue-dark);transform:translateY(-1px)}.btn.secondary{background:#64748b}.btn.success{background:var(--green)}.btn.warning{background:var(--amber)}.btn.danger{background:var(--red)}.btn.ghost{background:#eef3fb;color:#1e3a6f}.btn.icon{width:40px;padding:9px}.btn svg{width:17px;height:17px;flex:none}.icon-btn{width:36px;height:36px;border-radius:9px;background:#eef3fb;color:#334155;display:inline-grid;place-items:center}.icon-btn:hover{background:#e1e9f7}.icon-btn.danger{background:#fee2e2;color:#b91c1c}.icon-btn.success{background:#dcfce7;color:#166534}.icon-btn.warning{background:#fef3c7;color:#92400e}.icon-btn svg{width:17px;height:17px}
.top-icon{width:42px;height:42px;min-width:42px;min-height:42px;padding:0;font-size:0;position:relative;display:inline-flex!important;align-items:center;justify-content:center;line-height:0;flex:0 0 42px}.top-icon::before{content:"";position:absolute;left:50%;top:50%;width:19px;height:19px;display:block;background:currentColor;transform:translate(-50%,-50%);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:contain;mask-size:contain}.top-icon[aria-label="Sync mailboxes"]::before{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M20 11a8 8 0 0 0-14-5L4 8'/%3E%3Cpath d='M4 4v4h4'/%3E%3Cpath d='M4 13a8 8 0 0 0 14 5l2-2'/%3E%3Cpath d='M20 20v-4h-4'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M20 11a8 8 0 0 0-14-5L4 8'/%3E%3Cpath d='M4 4v4h4'/%3E%3Cpath d='M4 13a8 8 0 0 0 14 5l2-2'/%3E%3Cpath d='M20 20v-4h-4'/%3E%3C/svg%3E")}.top-icon[aria-label="Mailbox domains"]::before{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E")}.top-icon[aria-label="Refresh dashboard"]::before{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M20 11a8 8 0 1 0 2 5'/%3E%3Cpath d='M20 5v6h-6'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M20 11a8 8 0 1 0 2 5'/%3E%3Cpath d='M20 5v6h-6'/%3E%3C/svg%3E")}.top-icon[aria-label="Logout"]::before{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M10 4H5v16h5'/%3E%3Cpath d='M13 8l4 4-4 4'/%3E%3Cpath d='M8 12h9'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M10 4H5v16h5'/%3E%3Cpath d='M13 8l4 4-4 4'/%3E%3Cpath d='M8 12h9'/%3E%3C/svg%3E")}
.notice{padding:11px 13px;border-radius:10px;margin:12px 0;display:none}.notice.show{display:block}.notice.ok{background:var(--green-bg);color:#166534}.notice.error{background:var(--red-bg);color:#991b1b}.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:18px}.stat{min-width:0;padding:17px 18px;background:#fff;border:1px solid var(--line);border-radius:15px}.stat-label{font-size:13px;color:var(--muted)}.stat-value{font-size:29px;font-weight:750;margin-top:3px}.stat-foot{font-size:12px;color:var(--muted);margin-top:3px}.kpi-grid{grid-template-columns:repeat(4,1fr)}.dashboard-panels{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-bottom:18px}.mini-panel,.activity-panel{margin-bottom:0}.health-row{display:flex;justify-content:space-between;align-items:center;padding:12px 0;border-bottom:1px solid #edf1f6;font-size:14px}.health-row:last-child{border-bottom:0}.health-row strong{font-size:18px}.activity-list{display:grid;gap:0;margin-top:10px}.activity-item{padding:11px 0;border-bottom:1px solid #edf1f6}.activity-item:last-child{border-bottom:0}.activity-title{font-weight:700;font-size:13px}.activity-meta{font-size:12px;color:var(--muted);margin-top:3px}.activity-details{font-size:12px;color:#475569;margin-top:3px;word-break:break-word}
.toolbar{display:flex;align-items:center;gap:9px;flex-wrap:wrap;padding:12px;background:#f8fafc;border:1px solid var(--line);border-radius:13px;margin:15px 0;min-width:0}.search{position:relative;flex:1;min-width:220px}.search input{width:100%;height:42px;padding:0 13px 0 39px;border:1px solid #ccd5e2;border-radius:10px;background:#fff;outline:none}.search input:focus{border-color:#7aa7f8;box-shadow:0 0 0 3px rgba(37,99,235,.09)}.search svg{position:absolute;left:13px;top:12px;width:17px;color:#64748b}.select{height:42px;padding:0 11px;border:1px solid #ccd5e2;border-radius:10px;background:#fff;color:#334155;outline:none}.selection-bar{display:flex;align-items:center;gap:9px;min-height:42px}.selection-count{font-size:13px;font-weight:700;color:#334155;margin-right:auto}
.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:13px}table{width:100%;border-collapse:collapse;font-size:13px;min-width:980px}th,td{padding:12px 11px;border-bottom:1px solid #edf1f6;text-align:left;vertical-align:middle}th{background:#f8fafc;color:#526176;font-size:12px;font-weight:750;text-transform:uppercase;letter-spacing:.04em;white-space:nowrap}tbody tr:hover{background:#fbfdff}tbody tr:last-child td{border-bottom:0}.subject{font-weight:650;max-width:330px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.subject-link{display:block;width:100%;padding:0;border:0;background:transparent;color:#153b7a;text-align:left;font:inherit;font-weight:650;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.subject-link:hover{text-decoration:underline;color:#2563eb}.address{max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.date-main{font-weight:600;white-space:nowrap}.date-sub{font-size:11px;color:var(--muted);margin-top:2px;white-space:nowrap}.checkbox{width:17px;height:17px;accent-color:var(--blue);cursor:pointer}.row-actions{display:flex;justify-content:flex-end;gap:5px;white-space:nowrap}.badge{display:inline-flex;align-items:center;gap:5px;padding:5px 9px;border-radius:999px;font-size:11px;font-weight:800;letter-spacing:.02em}.badge.public{background:var(--green-bg);color:#166534}.badge.private{background:#eef2f7;color:#475569}.dot{width:6px;height:6px;border-radius:50%;background:currentColor}
.pagination{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:14px;flex-wrap:wrap}.page-info{font-size:13px;color:var(--muted)}.page-buttons{display:flex;gap:6px}.page-btn{min-width:38px;height:36px;padding:0 11px;border-radius:9px;background:#eef3fb;color:#334155;font-weight:650}.page-btn.active{background:var(--blue);color:#fff}.page-btn:disabled{opacity:.45}
.rule-form{background:#f8fafc;border:1px solid var(--line);border-radius:14px;padding:15px;margin:15px 0}.rule-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.field label{display:block;font-size:12px;font-weight:650;color:#64748b;margin-bottom:6px}.field input{width:100%;height:42px;padding:0 11px;border:1px solid #ccd5e2;border-radius:10px;background:#fff;outline:none}.field input:focus{border-color:#7aa7f8;box-shadow:0 0 0 3px rgba(37,99,235,.09)}.field.full{grid-column:1/-1}.rules-toolbar{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin-bottom:12px}.rule-list{display:grid;gap:8px}.rule-item{border:1px solid var(--line);border-radius:13px;background:#fff;overflow:hidden}.rule-summary{display:grid;grid-template-columns:1fr 1fr 1.2fr auto;align-items:center;gap:12px;padding:13px 14px}.rule-label{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin-bottom:3px}.rule-value{font-size:13px;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rule-actions{display:flex;justify-content:flex-end}.empty{padding:32px;text-align:center;color:var(--muted)}
.modal{position:fixed;inset:0;background:rgba(8,20,49,.58);backdrop-filter:blur(4px);display:none;align-items:center;justify-content:center;padding:18px;z-index:50}.modal.show{display:flex}.modal-box{width:min(900px,100%);max-height:92vh;overflow:auto;background:#fff;border-radius:18px;padding:20px;box-shadow:0 24px 70px rgba(2,12,35,.25)}.modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px}.email-meta{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:13px;background:#f8fafc;border:1px solid var(--line);border-radius:12px;margin-bottom:14px}.meta-item{min-width:0}.meta-label{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}.meta-value{font-size:13px;font-weight:650;word-break:break-word;margin-top:2px}.email-viewer{width:100%;height:560px;border:1px solid #dbe2ea;border-radius:12px;background:#fff}.email-text{white-space:pre-wrap;word-break:break-word;background:#f8fafc;border:1px solid #dbe2ea;border-radius:12px;padding:15px;max-height:560px;overflow:auto;font-size:14px;line-height:1.55}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:14px}.login{max-width:460px;margin:10vh auto}.login .btn{width:100%}
@media(max-width:1100px){.kpi-grid{grid-template-columns:repeat(2,1fr)}.dashboard-panels{grid-template-columns:1fr}}@media(max-width:900px){.wrap{padding:14px}.stats{grid-template-columns:1fr}.rule-summary{grid-template-columns:1fr 1fr}.rule-actions{grid-column:1/-1;justify-content:flex-start}.email-meta{grid-template-columns:1fr}}
@media(max-width:650px){.wrap{padding:12px}.card{width:100%;padding:18px}.header{align-items:flex-start}.header-actions{width:100%;justify-content:flex-start;gap:8px}.header-actions .top-icon{flex:0 0 42px}.brand{align-items:flex-start}.brand>div:last-child{min-width:0}.brand h1{font-size:26px;line-height:1.12}.toolbar{align-items:stretch;gap:8px}.search{min-width:0;width:100%;flex-basis:100%}.search input{min-width:0}.select{flex:1;min-width:0}.selection-bar{width:100%;min-width:0}.selection-count{margin-right:0}.table-wrap{display:none}.mobile-list{display:grid;gap:8px;width:100%;min-width:0}.mobile-email{width:100%;min-width:0;max-width:100%;border:1px solid var(--line);border-radius:13px;padding:13px;background:#fff;overflow:hidden}.mobile-top{display:flex;justify-content:space-between;align-items:center;gap:10px;min-width:0}.mobile-subject{font-weight:700;margin:7px 0 5px;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mobile-line{font-size:12px;color:#64748b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;max-width:100%}.mobile-actions{display:flex;justify-content:flex-end;gap:5px;margin-top:10px;min-width:0}.rule-summary{grid-template-columns:1fr}.rule-actions{grid-column:auto}.email-viewer{height:430px}.modal{padding:10px}.modal-box{border-radius:15px;padding:15px}}
@media(min-width:651px){.mobile-list{display:none}}
