/* =====================================================================
   MailSift — Classic Professional UI
   ===================================================================== */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "Inter Display", "Inter", "Segoe UI Variable Display", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Fira Code", Menlo, monospace;

  /* Light (default) */
  --bg:            #FAFAF8;
  --bg-2:          #F4F4F2;
  --surface:       #FFFFFF;
  --surface-2:     #F7F7F5;
  --surface-solid: #FFFFFF;
  --border:        #E4E4E0;
  --border-strong: #CFCFCA;
  --text:          #141414;
  --text-2:        #525252;
  --text-3:        #A0A09A;
  --accent:        #2563EB;
  --accent-hover:  #1D4ED8;
  --accent-soft:   #EFF6FF;
  --accent-border: #BFDBFE;
  --success:       #16A34A;
  --danger:        #DC2626;
  --warn:          #D97706;
  --shadow-sm:     0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow:        0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
  --shadow-md:     0 4px 12px -2px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg:     0 20px 40px -12px rgb(0 0 0 / 0.14), 0 0 0 1px var(--border);
  --radius:        8px;
  --radius-lg:     12px;
  --sidebar-w:     256px;
  --ease:          cubic-bezier(.2, .8, .2, 1);

  --c-gmail:       #EA4335;
  --c-microsoft:   #2563EB;
  --c-yahoo:       #720E9E;
  --c-aol:         #C0392B;
  --c-others:      #71717A;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #111110;
    --bg-2:          #18181B;
    --surface:       #1C1C1F;
    --surface-2:     #232326;
    --surface-solid: #1C1C1F;
    --border:        #2E2E32;
    --border-strong: #3F3F46;
    --text:          #FAFAFA;
    --text-2:        #A1A1AA;
    --text-3:        #71717A;
    --accent:        #3B82F6;
    --accent-hover:  #60A5FA;
    --accent-soft:   #172554;
    --accent-border: #1E3A8A;
    --success:       #22C55E;
    --danger:        #F87171;
    --warn:          #FBBF24;
    --shadow-sm:     0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow:        0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.3);
    --shadow-md:     0 4px 12px -2px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg:     0 20px 40px -12px rgb(0 0 0 / 0.6), 0 0 0 1px var(--border);
  }
}

/* ---------------------------------------------------------------- Reset */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
}
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; }
p { margin: 0; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.ico { width: 16px; height: 16px; flex: none; fill: none; }
.ico.sm { width: 13px; height: 13px; }
.ico.xl { width: 36px; height: 36px; }

/* Mac titlebar drag area */
.titlebar { position: fixed; inset: 0 0 auto 0; height: 40px; -webkit-app-region: drag; z-index: 5; }
button, input, textarea, a, .nav-item, .card, .domain { -webkit-app-region: no-drag; }

/* ---------------------------------------------------------------- Layout */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }

/* ---------------------------------------------------------------- Sidebar */
.sidebar {
  position: relative;
  z-index: 6;
  display: flex;
  flex-direction: column;
  padding: 44px 0 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.brand-mark svg { width: 28px; height: 28px; display: block; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 0 8px;
}

.nav-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 16px 8px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.04em;
}
.nav-label .hint {
  font-weight: 400;
  letter-spacing: 0;
  opacity: 0;
  transition: opacity .15s;
}
.app.dragging .nav-label .hint { opacity: 1; color: var(--accent); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-2);
  font-weight: 500;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background .1s, color .1s;
}
.nav-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  border: 1px solid var(--accent-border);
}
.nav-item:disabled { opacity: .4; cursor: default; }
.nav-item .count {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  padding: 0 6px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-width: 20px;
  text-align: center;
}
.nav-item.active .count {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* Drag drop */
.app.dragging .nav-groups .nav-item { outline: 1px dashed var(--border-strong); outline-offset: -1px; }
.nav-item.drop-over, .card.drop-over {
  background: var(--accent-soft) !important;
  outline: 1px solid var(--accent-border) !important;
  color: var(--accent) !important;
}
.nav-item.drop-source { opacity: .35; }

.nav-add {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 4px 0;
  padding: 7px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-3);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.nav-add:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.sidebar-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.privacy {
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 11px;
  color: var(--text-3);
}
.privacy .ico { width: 12px; height: 12px; color: var(--success); }

/* ---------------------------------------------------------------- Main */
.main { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.view {
  position: absolute; inset: 0;
  padding: 40px 32px 24px;
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}
.app[data-state="empty"]      .view-empty,
.app[data-state="processing"] .view-processing,
.app[data-state="overview"]   .view-overview,
.app[data-state="group"]      .view-group,
.app[data-state="typos"]      .view-typos { display: flex; animation: viewIn .2s ease both; }
@keyframes viewIn { from { opacity: 0; } }

/* ---------------------------------------------------------------- Focus */
.btn:focus-visible,
.nav-item:focus-visible,
.card:focus-visible,
.dropzone:focus-visible,
.domain:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .1s, border-color .1s, color .1s, box-shadow .1s;
}
.btn:active { opacity: .85; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14px; border-radius: var(--radius-lg); }

.btn-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border);
}
.btn-soft:hover { background: var(--accent-border); }
.btn-soft:disabled { opacity: .55; cursor: progress; }

.btn-link {
  background: none;
  color: var(--text-3);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0 6px;
  border: 0;
}
.btn-link:hover { color: var(--text-2); }

.btn-danger-ghost { background: transparent; color: var(--danger); border: 0; }
.btn-danger-ghost:hover { background: rgb(220 38 38 / 0.08); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  border: 0;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.btn-mini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .1s;
}
.btn-mini:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-mini .ico { width: 13px; height: 13px; }

/* ---------------------------------------------------------------- Dropzone */
.view-empty { align-items: center; justify-content: center; }
.dropzone {
  position: relative;
  width: min(680px, 100%);
  padding: 48px 48px 40px;
  text-align: center;
  border-radius: var(--radius-lg);
  border: 1.5px dashed var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.dropzone:hover { border-color: var(--accent); }
.orb { display: none; }
.dropzone h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-top: 20px;
}
.dropzone p {
  max-width: 480px;
  margin: 10px auto 0;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.65;
}
.drop-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}
.steps {
  display: flex;
  justify-content: center;
  gap: 24px;
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  color: var(--text-3);
  font-size: 12.5px;
}
.steps li { display: flex; align-items: center; gap: 7px; }
.steps span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
}
.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 20%, transparent);
}
.pill.gmail     { --c: var(--c-gmail); }
.pill.microsoft { --c: var(--c-microsoft); }
.pill.yahoo     { --c: var(--c-yahoo); }
.pill.aol       { --c: var(--c-aol); }

/* Drop icon */
.drop-icon {
  position: relative;
  width: 96px;
  height: 76px;
  margin: 0 auto;
}
.env {
  position: absolute;
  left: 50%; top: 50%;
  width: 68px; height: 48px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  translate: -50% -50%;
}
.env::after {
  content: "";
  position: absolute;
  inset: 7px 10px auto;
  height: 18px;
  border: 1.5px solid var(--text-3);
  border-top: 0;
  border-right-color: transparent;
  border-left-color: transparent;
  border-radius: 0 0 3px 3px;
  transform: perspective(40px) rotateX(-35deg);
  opacity: .4;
}
.env-1 { rotate: -14deg; translate: -92% -44%; border-color: color-mix(in srgb, var(--c-gmail) 30%, var(--border-strong)); }
.env-2 { rotate: 12deg; translate: -8% -44%; border-color: color-mix(in srgb, var(--c-microsoft) 30%, var(--border-strong)); }
.env-3 { background: var(--accent); border-color: var(--accent); }
.env-3::after { border-bottom-color: rgba(255,255,255,.6); opacity: .7; }
.drop-arrow { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; translate: -50% -30%; color: #fff; z-index: 2; fill: none; }

/* File drag overlay */
.file-overlay {
  position: fixed; inset: 8px; z-index: 50;
  display: grid; place-items: center;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--accent);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.file-overlay.show { opacity: 1; }
.file-overlay-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; font-size: 18px; color: var(--accent);
}
.file-overlay .ico { width: 36px; height: 36px; }

/* ---------------------------------------------------------------- Processing */
.view-processing { align-items: center; justify-content: center; }
.processing-card {
  width: min(400px, 100%);
  padding: 36px;
  text-align: center;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.processing-card h2 { margin-top: 16px; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.processing-card .muted { margin-top: 4px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spinner {
  width: 40px; height: 40px; margin: 0 auto;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { rotate: 1turn; } }
.progress { height: 4px; margin-top: 20px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress-bar {
  height: 100%; width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width .2s;
}
.proc-stats { margin-top: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.proc-stats b { color: var(--text); font-size: 15px; }

/* ---------------------------------------------------------------- Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -0.025em; }
.topbar .muted { margin-top: 2px; font-size: 12.5px; }
.topbar-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-bottom: 20px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}
.stat {
  padding: 14px 16px;
  background: var(--surface);
}
.stat-label { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 500; margin-bottom: 4px; }
.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.stat-accent { }
.stat-accent .stat-value { color: var(--accent); }
.stat-sub { display: block; margin-top: 1px; font-size: 11px; color: var(--text-3); }

/* ---------------------------------------------------------------- Tips */
.tip {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
}
.tip > .ico { width: 18px; height: 18px; color: var(--accent); flex: none; }
.tip div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.tip div b { font-size: 13px; font-weight: 600; }
.tip span { color: var(--text-2); font-size: 12.5px; }
#mx-tip { margin: 0 0 16px; }
.tip-hero { padding: 16px 18px; }
.tip .btn { flex-shrink: 0; }
.tip .mx-progress { display: block; height: 4px; margin-top: 6px; border-radius: 99px; background: var(--border); overflow: hidden; }
.tip .mx-progress[hidden] { display: none; }
#mx-progress-bar { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .25s ease; }

.tip-warn {
  margin: 0 0 16px;
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
  background: color-mix(in srgb, var(--warn) 8%, var(--surface));
}
.tip-warn > .ico { color: var(--warn); }

.tip-info {
  margin: 0 0 16px;
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.tip-info > .ico { color: var(--accent); }

/* ---------------------------------------------------------------- Overview grid */
.overview-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
  margin-top: 4px;
}
.panel {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.panel h3 { font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 12px; }
.donut-wrap { position: relative; width: 160px; height: 160px; margin: 0 auto 12px; }
.donut { width: 100%; height: 100%; rotate: -90deg; overflow: visible; }
.donut circle {
  fill: none;
  stroke-width: 12;
  transition: stroke-dasharray .6s var(--ease), stroke-dashoffset .6s var(--ease), stroke-width .15s;
  cursor: pointer;
}
.donut circle:hover { stroke-width: 15; }
.donut-center {
  position: absolute; inset: 0;
  display: grid; place-content: center; text-align: center; pointer-events: none;
}
.donut-center b { font-family: var(--font-display); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.025em; }
.donut-center span { font-size: 11px; color: var(--text-3); }

.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.legend li {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 6px;
  font-size: 12.5px; cursor: pointer;
  transition: background .1s;
}
.legend li:hover { background: var(--surface-2); }
.legend li span:nth-child(2) { flex: 1; color: var(--text-2); }
.legend li b { font-variant-numeric: tabular-nums; font-weight: 600; }
.legend li small { width: 38px; text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 11.5px; }

/* Provider cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card {
  --g: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  cursor: pointer;
  text-align: left;
  background: var(--surface);
  transition: background .1s;
  animation: cardIn .3s ease both;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--g); }
.card::after { display: none; }
.card:hover { background: var(--surface-2); }
@keyframes cardIn { from { opacity: 0; } }
.card-top { display: flex; align-items: center; gap: 10px; }
.badge {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  font-weight: 700; font-size: 14px; color: #fff;
  background: var(--g);
  flex: none;
}
.card-name { font-weight: 600; font-size: 13.5px; }
.card-desc { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-count {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.card-count small { font-size: 12.5px; font-weight: 500; color: var(--text-3); margin-left: 4px; letter-spacing: 0; }
.bar { height: 3px; border-radius: 99px; background: var(--border); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--g); transition: width .6s var(--ease); }
.card-actions { display: flex; gap: 5px; }
.card.is-empty { opacity: .5; }
.card.is-empty .card-actions { visibility: hidden; }

.suggest { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.suggest-label { font-size: 12px; font-weight: 600; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; }
.suggest-label .ico { color: var(--accent); }
.suggest-list { display: flex; flex-wrap: wrap; gap: 5px; }
.suggest-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 6px;
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: all .1s;
}
.suggest-chip:hover { border-style: solid; border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, var(--surface)); }
.suggest-chip .ico { width: 12px; height: 12px; color: var(--c); }
.suggest-chip b { font-weight: 500; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Group view */
.group-head { display: flex; align-items: center; gap: 12px; }
.group-dot {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
}
.domains-block { margin-bottom: 14px; }
.domains-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin-bottom: 8px;
}
.domains-head h3 { font-size: 12px; font-weight: 600; color: var(--text-3); }
.domains { display: flex; flex-wrap: wrap; gap: 5px; max-height: 112px; overflow-y: auto; padding: 1px; }
.domain {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px 4px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px; cursor: grab; transition: border-color .1s;
}
.domain:hover { border-color: var(--border-strong); }
.domain:active { cursor: grabbing; }
.domain .ico { width: 11px; height: 11px; color: var(--text-3); }
.domain b { font-size: 10.5px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.domain.more { cursor: pointer; color: var(--accent); padding-left: 8px; }

.list-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color .1s, box-shadow .1s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search .ico { color: var(--text-3); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; user-select: text; font-size: 13px; }

.vlist {
  position: relative; flex: 1; min-height: 200px; overflow-y: auto;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  contain: strict;
}
.vlist-spacer { position: relative; width: 100%; }
.row {
  position: absolute; left: 0; right: 0; height: 36px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12.5px;
  cursor: grab;
  user-select: text;
}
.row:hover { background: var(--surface-2); }
.row .ico { width: 13px; height: 13px; color: var(--text-3); opacity: 0; transition: opacity .1s; }
.row:hover .ico { opacity: 1; }
.row .num { width: 48px; color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.row .addr { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .addr mark { background: color-mix(in srgb, var(--accent) 18%, transparent); color: inherit; border-radius: 2px; }
.row .row-copy { opacity: 0; }
.row:hover .row-copy { opacity: 1; }
.empty-list { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--text-3); gap: 4px; }

/* ---------------------------------------------------------------- Modals */
.modal {
  width: min(500px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px) scale(.98);
  transition-property: opacity, transform, display, overlay;
  transition-duration: .2s;
  transition-timing-function: var(--ease);
  transition-behavior: allow-discrete;
}
.modal-sm { width: min(400px, calc(100vw - 32px)); }
.modal[open] {
  opacity: 1; transform: none;
  @starting-style { opacity: 0; transform: translateY(8px) scale(.98); }
}
.modal::backdrop {
  background-color: rgb(0 0 0 / 0);
  backdrop-filter: blur(0);
  transition-property: background-color, backdrop-filter, display, overlay;
  transition-duration: .2s;
  transition-behavior: allow-discrete;
}
.modal[open]::backdrop {
  background-color: rgb(0 0 0 / 0.4);
  backdrop-filter: blur(4px);
  @starting-style { background-color: rgb(0 0 0 / 0); backdrop-filter: blur(0); }
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 20px 10px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; }
.modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}
.spacer { flex: 1; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field-label small { font-weight: 400; color: var(--text-3); margin-left: 3px; }
.field input, .field textarea {
  width: 100%; padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  outline: none; user-select: text; resize: vertical;
  font-size: 13px;
  transition: border-color .1s, box-shadow .1s;
}
.field textarea { font-family: var(--mono); }
.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.presets { display: flex; flex-direction: column; gap: 6px; }
.preset-list { display: flex; flex-wrap: wrap; gap: 5px; }
.preset {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px; cursor: pointer; transition: all .1s;
}
.preset:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.preset .dot { width: 7px; height: 7px; }

.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch {
  width: 24px; height: 24px; border-radius: 50%; border: 0;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: outline-color .1s, transform .1s;
}
.swatch:hover { transform: scale(1.1); }
.swatch[aria-checked="true"] { outline-color: var(--text); }

.format-choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.format { position: relative; cursor: pointer; }
.format input { position: absolute; opacity: 0; }
.format span {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px; border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  transition: all .1s; height: 100%;
}
.format b { font-size: 14px; }
.format small { color: var(--text-3); font-size: 11.5px; line-height: 1.4; }
.format input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.format input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { accent-color: var(--accent); width: 14px; height: 14px; }

/* ---------------------------------------------------------------- Toasts */
.toasts {
  position: fixed; bottom: 18px; left: 50%; translate: -50% 0;
  z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 7px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px 9px 13px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  font-size: 13px; font-weight: 500;
  pointer-events: auto;
  animation: toastIn .2s ease both;
}
.toast.out { animation: toastOut .15s ease forwards; }
.toast .ico { color: var(--success); }
.toast.error .ico { color: var(--danger); }
.toast button {
  border: 0; background: rgba(255,255,255,.12); padding: 3px 9px;
  border-radius: 5px; font-weight: 600; font-size: 12px; cursor: pointer;
  color: inherit; margin-left: 2px;
}
.toast button:hover { background: rgba(255,255,255,.2); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* Drag ghost */
.drag-ghost {
  position: fixed; top: -100px; left: -100px;
  padding: 5px 10px; border-radius: 5px;
  background: var(--accent); color: #fff;
  font-weight: 600; font-size: 12px; white-space: nowrap;
}

/* ---------------------------------------------------------------- Columns / typos / suggestions */
.columns-kept { display: flex; align-items: center; gap: 5px; margin-top: 2px !important; }
.columns-kept .ico { width: 12px; height: 12px; color: var(--accent); }

.row .snippet {
  flex: 0 1 40%; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font); font-size: 12px; color: var(--text-3);
}

.nav-typos.has-items .count { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.nav-typos.has-items .ico { color: var(--warn); }

.typo-dot {
  background: var(--warn) !important;
  color: #fff;
}

.typo-list { display: flex; flex-direction: column; gap: 6px; }
.typo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  animation: cardIn .25s ease both;
}
.typo-from, .typo-to { font-family: var(--mono); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.typo-from { color: var(--danger); text-decoration: line-through; text-decoration-thickness: 1px; opacity: .8; }
.typo-to { color: var(--success); font-weight: 600; }
.typo > .ico { color: var(--text-3); }
.typo-meta { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.typo-meta.invalid { color: var(--danger); }
.typo-actions { display: flex; gap: 5px; }
.btn-fix {
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
  color: var(--success);
}
.btn-fix:hover { background: color-mix(in srgb, var(--success) 16%, var(--surface)); border-color: var(--success); }
.typo.done { opacity: .6; }
.typo.done .typo-from { text-decoration-line: none; }
.typo-fixed { margin-top: 24px; }
.typo-fixed h3 { font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 8px; }
.typo-empty {
  padding: 48px 20px; text-align: center; color: var(--text-3);
  border-radius: var(--radius); border: 1px dashed var(--border-strong);
}
.typo-empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 3px; }

/* ---------------------------------------------------------------- Cleanup panel */
.cleanup-panel {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  flex-shrink: 0;
}
.cleanup-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.cleanup-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0;
  flex: 1;
}
.cleanup-status {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 500;
}
.cleanup-row-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  min-height: 44px;
}
#cleanup-disposable-section .cleanup-row-top { border-bottom: none; }
#cleanup-role-section:last-child .cleanup-row-top,
#cleanup-free-section:last-child .cleanup-row-top { border-bottom: none; }
.cleanup-row-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
}
.cleanup-row-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  min-width: 44px;
  text-align: right;
}
.cleanup-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  transition: color .15s, border-color .15s, background .15s;
  user-select: none;
  white-space: nowrap;
}
.cleanup-pill input { display: none; }
.cleanup-pill span:first-of-type {
  display: none;
}
.cleanup-pill:hover { border-color: var(--accent); color: var(--accent); }
.cleanup-pill.is-on {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.cleanup-domains {
  padding: 0 16px 10px 36px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--border);
}
.cleanup-domain-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.cleanup-domain-name {
  flex: 1;
  font-size: 12.5px;
  color: var(--text-2);
  font-family: 'SF Mono', ui-monospace, monospace;
}
.cleanup-domain-count {
  font-size: 12.5px;
  color: var(--text-3);
  min-width: 40px;
  text-align: right;
}
.cleanup-domain-row .cleanup-pill { font-size: 11.5px; padding: 2px 8px; }

/* ---------------------------------------------------------------- Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1100px) {
  .overview-grid { grid-template-columns: 1fr; }
  .chart-panel { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 20px; }
  .chart-panel h3 { grid-column: 1 / -1; }
  .donut-wrap { margin: 8px 0; }
}
@media (max-width: 960px) { .stats { grid-template-columns: repeat(2, 1fr); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .modal, .modal[open] { transform: none; transition-duration: .05s; }
  @starting-style { .modal[open] { transform: none; } }
}
