:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17202b;
  background: #f5f7f9;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f5f7f9; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 20%, #e8f6ef 0, transparent 35%), #f7f8fa; }
.auth-card { width: min(560px, 100%); padding: 42px; background: #fff; border: 1px solid #e1e6ea; border-radius: 28px; box-shadow: 0 24px 80px rgba(28,42,55,.09); }
.auth-card h1 { font-size: clamp(34px, 6vw, 56px); line-height: 1.02; letter-spacing: -.045em; margin: 24px 0 16px; }
.brand-lockup { display: flex; align-items: center; gap: 10px; font-weight: 760; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; background: #173c34; color: white; font-size: 12px; letter-spacing: .02em; }
.eyebrow { margin: 0 0 8px; color: #718077; font-size: 12px; font-weight: 760; text-transform: uppercase; letter-spacing: .12em; }
.muted { color: #6b7783; line-height: 1.6; }
.stack { display: grid; gap: 10px; margin-top: 28px; }
.stack label { font-size: 13px; font-weight: 700; }
input, select { border: 1px solid #d8e0e4; background: #fff; border-radius: 12px; padding: 12px 14px; color: #17202b; outline: none; }
input:focus, select:focus { border-color: #2e6d5d; box-shadow: 0 0 0 3px rgba(46,109,93,.12); }
.trust-note { margin-top: 20px; padding: 12px 14px; border-radius: 12px; background: #edf8f2; color: #285d50; font-size: 13px; }
.trust-note span { margin-right: 7px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 16px; border-right: 1px solid #e2e7ea; background: rgba(250,251,252,.94); display: flex; flex-direction: column; }
.sidebar-brand { padding: 0 8px 24px; }
.nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-radius: 12px; padding: 11px 12px; background: transparent; color: #64717c; text-align: left; font-weight: 650; }
.nav-item span { width: 20px; color: #7e8c94; }
.nav-item:hover { background: #eef2f3; color: #26333d; }
.nav-item.active { background: #e6f1ed; color: #224e43; }
.sidebar-foot { margin-top: auto; display: grid; gap: 14px; }
.safety-chip { display: grid; gap: 3px; padding: 12px; border-radius: 12px; background: #edf8f2; color: #2b6455; font-size: 11px; }
.safety-chip strong { font-size: 12px; }
.safety-chip.compact { display: flex; flex-direction: column; min-width: 150px; }
.text-button { border: 0; padding: 0; background: transparent; color: #527065; font-weight: 700; font-size: 13px; text-align: left; }
.text-button:hover { color: #183f35; }
.inline-link { margin-top: 6px; }

.main { min-width: 0; padding: 0 34px 60px; }
.topbar { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid #e4e8eb; margin-bottom: 28px; }
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.account-select-wrap select { max-width: 250px; }
.button { border: 1px solid transparent; border-radius: 11px; padding: 11px 15px; font-weight: 730; transition: .15s ease; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: #173c34; color: #fff; }
.button.primary:hover { background: #204f43; }
.button.secondary { border-color: #d7dfe2; background: #fff; color: #40505a; }

.view { animation: fade .16s ease; }
@keyframes fade { from { opacity: .3; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.scan-banner { margin-bottom: 22px; padding: 16px 18px; border-radius: 16px; border: 1px solid #d5e9df; background: #f2faf6; display: grid; grid-template-columns: 1fr minmax(140px, 260px); align-items: center; gap: 20px; }
.scan-banner strong, .scan-banner span { display: block; }
.scan-banner span { margin-top: 4px; color: #63756c; font-size: 13px; }
.progress { height: 8px; overflow: hidden; border-radius: 99px; background: #dbe9e2; }
.progress span { height: 100%; width: 25%; margin: 0; border-radius: inherit; background: #4b8a75; animation: progress 1.3s ease-in-out infinite alternate; }
@keyframes progress { to { transform: translateX(260%); } }

.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.hero-card, .panel, .metric-card, .review-hero { background: #fff; border: 1px solid #e1e6e9; border-radius: 20px; }
.hero-card { min-height: 220px; padding: 28px; }
.cleanup-card { background: linear-gradient(145deg,#fff 55%,#edf6f1); }
.health-score { display: flex; align-items: baseline; gap: 4px; margin: 18px 0 6px; }
.health-score span { font-size: 68px; line-height: .9; letter-spacing: -.06em; font-weight: 780; color: #173c34; }
.health-score small { color: #78858d; font-weight: 700; }
.big-number { display: block; margin: 30px 0 8px; font-size: 50px; letter-spacing: -.05em; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin: 18px 0; }
.metric-card { padding: 18px; }
.metric-card span, .metric-card small { display: block; color: #7a878f; font-size: 12px; }
.metric-card strong { display: block; margin: 10px 0 2px; font-size: 28px; letter-spacing: -.035em; }
.content-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; }
.panel { padding: 22px; min-width: 0; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.badge { padding: 5px 8px; border-radius: 99px; background: #eff3f4; color: #6d7a81; font-size: 11px; font-weight: 750; }

.category-list { display: grid; gap: 6px; }
.category-row { display: grid; grid-template-columns: minmax(120px,1fr) 2fr auto; align-items: center; gap: 12px; border-radius: 10px; padding: 9px; }
.category-row:hover { background: #f7f9fa; }
.category-name { display: flex; align-items: center; gap: 9px; min-width: 0; font-weight: 670; font-size: 13px; }
.category-dot { width: 8px; height: 8px; border-radius: 50%; background: #739689; }
.bar { height: 6px; border-radius: 99px; background: #edf0f2; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: #789c8f; }
.category-row strong { font-size: 12px; color: #65727a; }

.sender-list { display: grid; }
.sender-row, .data-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 4px; border-bottom: 1px solid #edf0f2; }
.sender-row:last-child, .data-row:last-child { border-bottom: 0; }
.sender-main { min-width: 0; display: flex; align-items: center; gap: 11px; }
.avatar { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center; background: #eef3f1; color: #365b50; font-size: 12px; font-weight: 800; }
.sender-copy { min-width: 0; }
.sender-copy strong, .sender-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sender-copy strong { font-size: 13px; }
.sender-copy span { margin-top: 3px; color: #879198; font-size: 11px; }
.sender-row > strong { font-size: 13px; color: #66737b; }

.section-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin: 2px 0 20px; }
.section-intro h2, .review-hero h2 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
.section-intro p, .review-hero p { margin: 7px 0 0; color: #71808a; }
.data-list { overflow: hidden; border: 1px solid #e1e6e9; border-radius: 18px; background: #fff; }
.data-row { padding: 15px 18px; }
.data-row-main { min-width: 0; flex: 1; }
.data-row-main strong, .data-row-main span { display: block; }
.data-row-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.data-row-main span { margin-top: 5px; color: #849097; font-size: 11px; }
.row-stats { display: flex; gap: 16px; color: #69777f; font-size: 12px; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.choice { border: 1px solid #dde4e7; border-radius: 9px; padding: 7px 9px; background: #fff; color: #68757d; font-size: 11px; font-weight: 730; }
.choice:hover, .choice.selected { border-color: #b9d5c9; background: #edf7f2; color: #285a4d; }
.choice.warn:hover, .choice.warn.selected { border-color: #efd2b5; background: #fff5e9; color: #89572c; }
.choice.cleanup:hover, .choice.cleanup.selected { border-color: #d8dce0; background: #f1f3f4; color: #37434b; }

.review-hero { display: flex; justify-content: space-between; align-items: center; gap: 26px; padding: 26px; margin-bottom: 18px; background: linear-gradient(135deg,#fff 50%,#eef8f3); }
.review-total { min-width: 180px; padding-left: 24px; border-left: 1px solid #dce6e1; }
.review-total span, .review-total strong { display: block; }
.review-total span { color: #718078; font-size: 12px; }
.review-total strong { margin-top: 7px; font-size: 38px; letter-spacing: -.05em; }
.review-grid { align-items: start; }
.review-item { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 12px 2px; border-bottom: 1px solid #edf0f2; }
.review-item:last-child { border-bottom: 0; }
.review-item strong { font-size: 13px; }
.review-item span { color: #849097; font-size: 11px; }

.connect-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 22px; }
.provider-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; border: 1px solid #dde3e6; border-radius: 15px; padding: 16px; background: #fff; color: #26333c; text-align: left; }
.provider-card:hover { border-color: #b9cec6; box-shadow: 0 8px 24px rgba(28,54,45,.06); }
.provider-card strong, .provider-card small { display: block; }
.provider-card small { margin-top: 3px; color: #879198; }
.provider-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #f1f3f4; font-weight: 850; }
.empty-state { max-width: 680px; margin: 11vh auto 0; text-align: center; }
.empty-state h2 { font-size: 36px; letter-spacing: -.04em; margin: 7px 0 10px; }
.empty-state > p { color: #70808a; line-height: 1.6; }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 18px; background: #e7f2ed; color: #315e51; font-size: 22px; }
.account-connect-grid { margin-bottom: 18px; }
.toast { position: fixed; z-index: 20; right: 22px; bottom: 22px; max-width: 380px; padding: 13px 16px; border-radius: 12px; background: #1f2e35; color: white; box-shadow: 0 12px 40px rgba(15,27,34,.2); font-size: 13px; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: none; opacity: 1; }
.toast.error { background: #713b3b; }
.skeleton { border-radius: 9px; background: linear-gradient(90deg,#eff2f3,#f8f9fa,#eff2f3); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton.large { height: 160px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-inline { padding: 30px 10px; text-align: center; color: #879198; font-size: 13px; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 76px minmax(0,1fr); }
  .sidebar { padding-inline: 10px; }
  .sidebar-brand span:last-child, .nav-item:not(.active) { font-size: 0; }
  .sidebar-brand { justify-content: center; padding-inline: 0; }
  .nav-item { justify-content: center; padding: 12px; font-size: 0; }
  .nav-item.active { font-size: 0; }
  .nav-item span { width: auto; font-size: 18px; }
  .sidebar-foot .safety-chip, .sidebar-foot .text-button { display: none; }
  .hero-grid, .content-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 700px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 10; top: auto; bottom: 0; width: 100%; height: 68px; border-right: 0; border-top: 1px solid #dfe5e8; padding: 8px 12px; }
  .sidebar-brand, .sidebar-foot { display: none; }
  .nav { grid-template-columns: repeat(5,1fr); gap: 2px; }
  .nav-item, .nav-item.active, .nav-item:not(.active) { font-size: 0; padding: 10px; }
  .nav-item span { font-size: 18px; }
  .main { padding: 0 16px 94px; }
  .topbar { min-height: auto; padding: 18px 0; align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .account-select-wrap { grid-column: 1/-1; }
  .account-select-wrap select { width: 100%; max-width: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .hero-card { min-height: auto; }
  .scan-banner { grid-template-columns: 1fr; }
  .connect-grid { grid-template-columns: 1fr; }
  .section-intro, .review-hero { align-items: flex-start; flex-direction: column; }
  .review-total { border-left: 0; padding-left: 0; }
  .data-row { align-items: flex-start; flex-direction: column; }
  .row-actions { justify-content: flex-start; }
  .row-stats { flex-wrap: wrap; }
}

.execution-callout { margin-top: 18px; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid #d5e5dd; border-radius: 14px; background: #f4faf7; }
.execution-callout strong, .execution-callout span { display: block; }
.execution-callout span { margin-top: 4px; max-width: 540px; color: #738079; font-size: 11px; line-height: 1.5; }
.execution-active { margin-bottom: 18px; }
.execution-history { margin-top: 18px; }
.data-list.flat { border: 0; border-radius: 0; }
.batch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
.batch-title strong, .batch-title span { display: block; }
.batch-title strong { font-size: 20px; }
.batch-title span { margin-top: 5px; color: #7a878f; font-size: 12px; }
.batch-metrics { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.batch-metric { padding: 12px; border: 1px solid #e5eaec; border-radius: 12px; background: #fafbfb; }
.batch-metric span, .batch-metric strong { display: block; }
.batch-metric span { color: #7b878e; font-size: 10px; }
.batch-metric strong { margin-top: 5px; font-size: 18px; }
.status-pill { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; background: #eef3f1; color: #49675e; font-size: 10px; font-weight: 780; }
.status-pill.alert { background: #fff0ea; color: #8b503b; }
.batch-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.execution-warning { margin: 12px 0; padding: 12px 14px; border-left: 3px solid #dca46d; background: #fff8ef; color: #735538; font-size: 12px; line-height: 1.5; }
@media (max-width: 700px) {
  .nav { grid-template-columns: repeat(6,1fr); }
  .execution-callout, .batch-head { align-items: stretch; flex-direction: column; }
  .batch-metrics { grid-template-columns: repeat(2,1fr); }
}

.compact-input{max-width:260px;border:1px solid var(--border,#d9dde5);border-radius:10px;padding:10px 12px;background:#fff;color:inherit}
.checkbox-row{display:flex;gap:.65rem;align-items:center;font-size:.9rem;color:var(--muted)}
.checkbox-row input{width:1rem;height:1rem}
