:root{
  --red:#e30613;
  --red-dark:#b8000d;
  --blue:#315a96;
  --blue-dark:#073763;
  --green:#168a55;
  --amber:#9a6400;
  --bg:#f3f5f8;
  --panel:#ffffff;
  --panel-soft:#f8fafc;
  --line:#dfe5ee;
  --line-strong:#cfd8e6;
  --text:#1f2328;
  --muted:#667085;
  --shadow:0 16px 38px rgba(31,41,55,.10);
}
*{box-sizing:border-box}
html,body{
  min-height:100%;
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
}
a{color:inherit;text-decoration:none}
button,input{font:inherit}
.topbar{
  min-height:64px;
  border-bottom:1px solid var(--line);
  background:rgba(255,255,255,.94);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:12px 18px;
  position:sticky;
  top:0;
  z-index:10;
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}
.brand img{
  width:42px;
  height:42px;
  border-radius:8px;
  object-fit:cover;
}
.brand span{display:grid;gap:2px;min-width:0}
.brand small,
.eyebrow{
  color:var(--muted);
  font-size:11px;
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
  margin:0;
}
.brand strong{
  font-size:16px;
  white-space:nowrap;
}
.top-actions,
.panel-head,
.table-head,
.mini-stats{
  display:flex;
  align-items:center;
  gap:10px;
}
.button{
  min-height:38px;
  border:1px solid transparent;
  border-radius:8px;
  padding:0 14px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight:850;
  cursor:pointer;
}
.button-primary{
  background:var(--red);
  color:#fff;
}
.button-primary:hover{background:var(--red-dark)}
.button-ghost{
  background:#fff;
  border-color:var(--line);
  color:#5d6978;
}
.button-ghost:hover{
  border-color:var(--blue);
  color:var(--blue);
}
.button:disabled{
  cursor:wait;
  opacity:.7;
}
.shell{
  width:min(1440px,100%);
  margin:0 auto;
  padding:18px;
  display:grid;
  gap:14px;
}
.toolbar,
.stat-card,
.panel,
.table-section{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:8px;
  box-shadow:var(--shadow);
}
.toolbar{
  min-height:94px;
  padding:18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
}
h1,h2{margin:0;line-height:1.16}
h1{
  margin-top:6px;
  font-size:24px;
}
h2{font-size:17px}
.sync-card{
  min-width:220px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--panel-soft);
  padding:12px;
  display:grid;
  gap:4px;
}
.sync-card span,
.sync-card small{
  color:var(--muted);
  font-size:12px;
}
.stats-grid{
  display:grid;
  grid-template-columns:repeat(5,minmax(150px,1fr));
  gap:10px;
}
.stat-card{
  min-height:96px;
  padding:14px;
  display:grid;
  gap:10px;
  align-content:center;
}
.stat-card span{color:var(--muted);font-size:13px}
.stat-card strong{font-size:25px}
.split-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}
.panel,
.table-section{
  padding:16px;
}
.panel-head,
.table-head{
  justify-content:space-between;
}
.panel-head strong{
  min-width:46px;
  min-height:38px;
  border-radius:8px;
  background:#eef3ff;
  color:var(--blue-dark);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0 10px;
}
.mini-stats{
  flex-wrap:wrap;
  margin-top:14px;
}
.mini-stats span{
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--panel-soft);
  color:var(--muted);
  padding:8px 10px;
  font-size:13px;
}
.mini-stats b{color:var(--text)}
.table-head{
  margin-bottom:12px;
}
.table-head input{
  width:min(340px,100%);
  min-height:38px;
  border:1px solid var(--line-strong);
  border-radius:8px;
  background:var(--panel-soft);
  color:var(--text);
  padding:0 12px;
}
.table-wrap{overflow:auto}
table{
  width:100%;
  min-width:980px;
  border-collapse:collapse;
}
th,td{
  border-bottom:1px solid var(--line);
  padding:11px 10px;
  text-align:left;
  vertical-align:top;
}
th{
  color:var(--muted);
  font-size:11px;
  font-weight:900;
  letter-spacing:.07em;
  text-transform:uppercase;
}
td{
  font-size:14px;
}
.email-name{
  display:grid;
  gap:4px;
}
.email-name strong{
  color:var(--text);
}
.email-name span{
  color:var(--muted);
  font-size:12px;
}
.metric-good{
  color:var(--green);
  font-weight:900;
}
.metric-warn{
  color:var(--amber);
  font-weight:900;
}
.preview-link{
  color:var(--red);
  font-weight:900;
}
.empty-state{
  color:var(--muted);
  text-align:center;
  padding:24px;
}
@media(max-width:1100px){
  .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .split-grid{grid-template-columns:1fr}
}
@media(max-width:720px){
  .topbar,
  .toolbar,
  .table-head{
    align-items:flex-start;
    flex-direction:column;
  }
  .top-actions{
    width:100%;
    flex-wrap:wrap;
  }
  .button{flex:1 1 110px}
  .shell{padding:12px}
  .stats-grid{grid-template-columns:1fr}
  .sync-card{width:100%;min-width:0}
}
