:root{
  --bg:#efede7;
  --panel:#fffdf8;
  --panel-strong:#ffffff;
  --ink:#10182b;
  --muted:#667085;
  --line:#e7e2d8;
  --soft:#f3efe7;
  --sidebar:#fffdf9;
  --sidebar-muted:#7c8493;
  --nav-active:#f2ede2;
  --shadow:0 12px 34px rgba(45,40,31,.055);
  --shadow-soft:0 5px 18px rgba(45,40,31,.035);
  --radius-xl:22px;
  --radius-lg:17px;
  --radius-md:13px;
  --lavender:#e5d4fb;
  --peach:#ffd9cb;
  --mint:#d7f1e2;
  --blue:#d9e8fb;
  --yellow:#fae8b9;
  --rose:#f9d7df;
  --green:#17804a;
  --danger:#c53d4b;
}

html{background:var(--bg)}
body{
  background:var(--bg);
  color:var(--ink);
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  letter-spacing:-.01em;
}
button,input,select,textarea{font:inherit}

#app{
  min-height:100vh;
  display:grid;
  grid-template-columns:238px minmax(0,1fr);
  gap:14px;
  padding:14px;
  background:var(--bg);
}

.sidebar{
  min-height:calc(100vh - 28px);
  height:calc(100vh - 28px);
  top:14px;
  padding:16px 12px 12px;
  border:1px solid var(--line);
  border-radius:var(--radius-xl);
  background:rgba(255,253,249,.97);
  color:var(--ink);
  box-shadow:var(--shadow-soft);
  overflow:auto;
  scrollbar-width:thin;
}

.brand{
  display:flex;
  align-items:center;
  gap:11px;
  margin:2px 8px 22px;
  color:var(--ink);
  font-size:18px;
  font-weight:800;
  letter-spacing:-.04em;
}
.brand-mark{
  width:38px;
  height:38px;
  display:grid;
  place-items:center;
  flex:0 0 auto;
  border-radius:11px;
  background:#111827;
  color:#fff;
  box-shadow:0 5px 14px rgba(17,24,39,.15);
}
.brand-mark svg{width:19px;height:19px}
.brand-copy{min-width:0}
.brand-copy strong{display:block;font-size:17px;line-height:1.1}
.brand-copy small,
.brand span{
  display:block;
  margin-top:4px;
  color:#758097;
  font-size:10px;
  font-weight:500;
  letter-spacing:0;
}

.sidebar nav{display:grid;gap:3px}
.nav,
.sidebar-shortcut{
  width:100%;
  min-height:39px;
  display:flex;
  align-items:center;
  gap:10px;
  margin:0;
  padding:9px 10px;
  border:0;
  border-radius:11px;
  background:transparent;
  color:#25304a;
  text-align:left;
  font-size:12px;
  font-weight:600;
  cursor:pointer;
  transition:background .14s ease,color .14s ease,transform .14s ease;
}
.nav:hover,
.sidebar-shortcut:hover{background:#f7f3eb;color:#10182b}
.nav.active{background:var(--nav-active);color:#10182b;font-weight:750}
.nav-icon{
  width:18px;
  height:18px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 18px;
  color:currentColor;
}
.nav-icon svg{width:17px;height:17px;stroke-width:1.8}
[data-module="duplicates"],#duplicateModule{display:none!important}

.sidebar-section{
  margin-top:17px;
  padding-top:15px;
  border-top:1px solid var(--line);
}
.sidebar-section-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 9px 6px;
  color:#1c263b;
  font-size:11px;
  font-weight:800;
}
.sidebar-section .sidebar-shortcut{min-height:35px;font-size:11px}
.sidebar-section .nav-icon{width:16px;height:16px;flex-basis:16px}
.sidebar-section .nav-icon svg{width:15px;height:15px}

.sidebar-foot{
  margin-top:auto;
  padding:13px 8px 2px;
  border-top:1px solid var(--line);
}
.workspace-profile{
  display:flex;
  align-items:center;
  gap:9px;
}
.workspace-avatar{
  width:34px;height:34px;border-radius:50%;display:grid;place-items:center;
  flex:0 0 auto;background:#172033;color:#fff;font-size:12px;font-weight:800;
}
.workspace-user{min-width:0;flex:1}
.workspace-user strong{display:block;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#userEmail{margin:3px 0 0;color:#778194;font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#signOut{
  width:30px;height:30px;padding:0;display:grid;place-items:center;
  border:1px solid var(--line);border-radius:9px;background:#fff;color:#4a5568;cursor:pointer;
}
#signOut:hover{background:#f4f0e8;color:#10182b}
#signOut svg{width:14px;height:14px}

main{
  min-width:0;
  margin:0;
  padding:22px;
  border:1px solid var(--line);
  border-radius:var(--radius-xl);
  background:rgba(255,253,248,.95);
  box-shadow:var(--shadow-soft);
}
.module-view{min-width:0}

/* Shared page headers */
.page-head,.detail-head,.targeting-head,.rd-head,.dq-head,.settings-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:20px;
  margin-bottom:18px;
}
.page-head h1,.detail-head h1,.targeting-head h1,.rd-head h1,.dq-head h1,.settings-head h1{
  margin:0;
  color:#0f172a;
  font-size:28px;
  line-height:1.05;
  letter-spacing:-.045em;
}
.page-head p,.detail-head p,.targeting-head p,.rd-head p,.dq-head p,.settings-head p{
  max-width:760px;
  margin:6px 0 0;
  color:#667085;
  font-size:12px;
  line-height:1.5;
}
.database-status{
  border:1px solid var(--line);
  background:#fff;
  color:#7a8190;
  border-radius:999px;
  padding:8px 11px;
  font-size:10px;
  font-weight:650;
}

/* Overview */
.overview-topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  margin-bottom:16px;
}
.overview-title h1{margin:0;color:#0f172a;font-size:29px;line-height:1;letter-spacing:-.05em}
.overview-title p{margin:6px 0 0;color:#667085;font-size:12px;line-height:1.4}
.overview-date{
  display:flex;align-items:center;gap:8px;padding-top:4px;color:#586278;font-size:10px;font-weight:600;white-space:nowrap
}
.overview-date svg{width:15px;height:15px}
.overview-toolbar{
  display:grid;
  grid-template-columns:minmax(260px,1fr) auto auto auto;
  gap:9px;
  margin-bottom:14px;
}
.overview-search-wrap{position:relative}
.overview-search-wrap svg{
  position:absolute;left:14px;top:50%;transform:translateY(-50%);width:17px;height:17px;color:#667085;pointer-events:none
}
.overview-search{
  width:100%;height:43px;border:1px solid #dedbd4;border-radius:12px;background:#fff;padding:0 14px 0 41px;color:#192235;font-size:11px;outline:none
}
.overview-search:focus{border-color:#aab1bd;box-shadow:0 0 0 3px rgba(71,85,105,.08)}
.overview-action{
  height:43px;display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:0 14px;
  border:1px solid #dedbd4;border-radius:12px;background:#fff;color:#263249;font-size:10px;font-weight:700;cursor:pointer;white-space:nowrap
}
.overview-action:hover{background:#f7f4ed}
.overview-action.primary{border-color:#111827;background:#111827;color:#fff;padding-inline:17px}
.overview-action svg{width:15px;height:15px}

.overview-stats{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:9px;
  margin-bottom:14px;
}
.overview-stat{
  min-width:0;
  min-height:116px;
  padding:13px;
  border:1px solid rgba(15,23,42,.04);
  border-radius:15px;
  text-align:left;
  color:#10182b;
  cursor:pointer;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.48);
}
.overview-stat:nth-child(1){background:var(--lavender)}
.overview-stat:nth-child(2){background:var(--peach)}
.overview-stat:nth-child(3){background:var(--mint)}
.overview-stat:nth-child(4){background:var(--blue)}
.overview-stat:nth-child(5){background:var(--yellow)}
.overview-stat:nth-child(6){background:var(--rose)}
.overview-stat:hover{filter:saturate(1.03);transform:translateY(-1px)}
.overview-stat-head{display:flex;align-items:center;gap:8px;min-width:0}
.overview-stat-icon{width:30px;height:30px;border-radius:10px;background:rgba(255,255,255,.46);display:grid;place-items:center;flex:0 0 auto}
.overview-stat-icon svg{width:16px;height:16px}
.overview-stat-label{min-width:0;font-size:9px;font-weight:700;line-height:1.15}
.overview-stat strong{display:block;margin-top:14px;font-size:26px;line-height:.95;letter-spacing:-.055em}
.overview-stat small{display:block;margin-top:7px;color:#455168;font-size:8px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.overview-grid{
  display:grid;
  grid-template-columns:1fr 1fr 1.08fr;
  gap:10px;
  align-items:start;
}
.overview-stack{display:grid;gap:10px}
.overview-panel{
  min-width:0;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:15px;
  background:#fffefa;
  box-shadow:0 3px 12px rgba(55,48,38,.018);
}
.overview-panel-head{
  display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 13px 10px;border-bottom:1px solid #eeeae2
}
.overview-panel-head h2{margin:0;font-size:12px;letter-spacing:-.025em}
.overview-panel-link{border:0;background:transparent;color:#273248;font-size:10px;font-weight:700;cursor:pointer;padding:4px}
.overview-panel-link:hover{text-decoration:underline}
.overview-list{display:grid}
.ov-row{
  width:100%;min-width:0;display:flex;align-items:center;gap:10px;padding:9px 12px;border:0;border-bottom:1px solid #f0ece4;background:transparent;text-align:left;color:#142036;cursor:pointer
}
.ov-row:last-child{border-bottom:0}
.ov-row:hover{background:#faf7f0}
.ov-logo{
  width:34px;height:34px;border-radius:10px;display:grid;place-items:center;flex:0 0 auto;background:#eff3f7;color:#26324a;font-size:10px;font-weight:800;text-transform:uppercase
}
.ov-logo.k{background:#e5f3ea;color:#146b42}.ov-logo.u{background:#e8eef9;color:#2f5b9c}.ov-logo.g{background:#eee7fb;color:#6645a8}.ov-logo.a{background:#fff0df;color:#995923}
.ov-row-main{min-width:0;flex:1}
.ov-row-main strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px;line-height:1.3}
.ov-row-main small{display:block;margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#778194;font-size:8px;line-height:1.3}
.ov-row-meta{flex:0 0 auto;color:#6c7689;font-size:8px;font-weight:600;white-space:nowrap}
.ov-tag{display:inline-flex;align-items:center;min-height:18px;padding:2px 6px;border-radius:6px;background:#eff1f4;color:#596274;font-size:7px;font-weight:650;margin-right:4px}
.ov-empty{padding:22px 14px;color:#7a8291;font-size:10px;text-align:center}

.overview-tasks .ov-row{align-items:flex-start}
.ov-check{width:15px;height:15px;margin-top:2px;border:1.5px solid #8d96a7;border-radius:4px;flex:0 0 auto;background:#fff}
.ov-priority{padding:3px 7px;border-radius:7px;background:#f1f2f4;color:#667085;font-size:7px;font-weight:700}
.ov-priority.due{background:#ffe8e8;color:#c23e48}

.quick-insights{padding:9px;display:grid;gap:7px}
.insight-card{display:flex;align-items:flex-start;gap:9px;padding:10px;border-radius:11px;background:#f6f4ef}
.insight-card:nth-child(1){background:#e6f5e9}.insight-card:nth-child(2){background:#f0e9fb}.insight-card:nth-child(3){background:#e9f1fb}
.insight-icon{width:31px;height:31px;border-radius:10px;background:rgba(255,255,255,.55);display:grid;place-items:center;flex:0 0 auto}
.insight-icon svg{width:16px;height:16px}
.insight-card strong{display:block;font-size:9px;line-height:1.25}.insight-card small{display:block;margin-top:3px;color:#667085;font-size:8px;line-height:1.35}

/* Settings */
.settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;max-width:900px}
.settings-card{border:1px solid var(--line);border-radius:16px;background:#fffefa;padding:17px}
.settings-card h2{margin:0 0 6px;font-size:14px}.settings-card p{margin:0 0 14px;color:#667085;font-size:11px;line-height:1.55}
.settings-value{padding:10px 11px;border-radius:10px;background:#f6f3ed;color:#28334a;font-size:10px;overflow-wrap:anywhere}
.settings-button{margin-top:12px;border:1px solid #d9d6cf;border-radius:10px;background:#fff;padding:9px 12px;color:#263249;font-size:10px;font-weight:700;cursor:pointer}
.settings-button.danger{color:#b93a47;border-color:#efc9cd;background:#fff9f9}

/* Existing module controls, brought into the same design system */
.targeting-filter-shell,.rd-toolbar,.dq-toolbar{
  border:1px solid var(--line)!important;
  border-radius:15px!important;
  background:#fffefa!important;
  box-shadow:none!important;
}
.targeting-filter-shell{padding:11px!important;margin-bottom:14px!important}
.primary-target-filters{gap:6px!important;padding-bottom:10px!important;border-color:#efeae1!important}
.target-filter-chip{
  border:1px solid #e1ddd5!important;background:#fff!important;color:#4a5568!important;border-radius:9px!important;padding:7px 10px!important;font-size:9px!important;font-weight:700!important
}
.target-filter-chip.active{background:#111827!important;color:#fff!important;border-color:#111827!important}
.secondary-target-filters{gap:7px!important;padding-top:10px!important}
.secondary-target-filters input,.secondary-target-filters select,.rd-toolbar input,.rd-toolbar select,.dq-toolbar input,.dq-toolbar select{
  min-height:38px!important;border:1px solid #dfdbd3!important;border-radius:10px!important;background:#fff!important;color:#263249!important;font-size:10px!important
}
.clear-target-filters,.rd-button,.dq-button,.back-button{
  border-radius:9px!important;font-size:9px!important;font-weight:700!important
}

.target-grid{gap:10px!important}
.target-card,.rd-card,.dq-card,.database-card,.profile-panel,.accelerator-group,.loading-panel,.empty-state,.data-note,.table-wrap{
  border-color:var(--line)!important;
  background:#fffefa!important;
  box-shadow:0 3px 14px rgba(55,48,38,.025)!important;
}
.target-card{min-height:330px!important;border-radius:15px!important;padding:14px!important}
.target-card:hover{transform:translateY(-1px)!important;box-shadow:0 8px 22px rgba(55,48,38,.055)!important}
.target-card h2{font-size:17px!important;color:#142036!important}
.target-location{background:#f8f5ef!important;border-color:#ece6dc!important}
.target-type{background:#172033!important}
.target-list-action{background:#172033!important;border-color:#172033!important;border-radius:9px!important}
.target-list-action.is-added{background:#fff!important;color:#172033!important;border-color:#d9d6cf!important}

.database-grid{gap:11px!important}
.database-card{min-height:218px!important;border-radius:16px!important;padding:17px!important}
.database-card h2{font-size:16px!important;color:#142036!important}
.database-index{background:#172033!important}
.database-card-top{margin-bottom:20px!important}
.data-table th{background:#f4f1eb!important;color:#6a7282!important}
.accelerator-toggle:hover,.data-table tbody tr:hover{background:#faf7f1!important}

.target-profile{background:rgba(16,24,43,.32)!important;backdrop-filter:blur(3px)}
.target-profile-panel{background:#f5f2ec!important;border-color:#ded8ce!important}
.profile-score{background:#172033!important}

/* Revenue desk */
.rd-stats,.dq-stats{gap:9px!important;margin-bottom:12px!important}
.rd-stat,.dq-stat{border:1px solid var(--line)!important;border-radius:13px!important;background:#fffefa!important;box-shadow:none!important}
.rd-card{border-radius:15px!important}
.rd-status{border-radius:7px!important}
.rd-block{background:#f7f4ee!important;border-color:#ece7de!important;border-radius:10px!important}
.rd-button.primary,.dq-button.primary{background:#172033!important;border-color:#172033!important;color:#fff!important}

/* Verification / Cohort */
.dq-card{border-radius:15px!important}
.dq-pill{border-radius:7px!important}
.dq-pill.verified{background:#e7f4eb!important;color:#18704a!important}
.dq-pill.issue{background:#fff0e4!important;color:#9b5b27!important}

/* Auth */
.auth-gate{background:var(--bg)!important}
.auth-card{border-color:var(--line)!important;border-radius:20px!important;background:#fffefa!important;box-shadow:var(--shadow)!important}
.auth-card .brand{margin-left:0;color:var(--ink)}
.auth-card input{border-color:#dfdbd3!important;border-radius:11px!important}
.primary{background:#172033!important;border-color:#172033!important}

@media(max-width:1320px){
  .overview-stats{grid-template-columns:repeat(3,minmax(0,1fr))}
  .overview-grid{grid-template-columns:1fr 1fr}
  .overview-stack:last-child{grid-column:1/-1;grid-template-columns:1fr 1fr}
}

@media(max-width:1040px){
  #app{grid-template-columns:205px minmax(0,1fr)}
  .overview-toolbar{grid-template-columns:1fr auto auto}.overview-action:nth-of-type(1){display:none}
  .overview-grid{grid-template-columns:1fr}.overview-stack:last-child{grid-column:auto;grid-template-columns:1fr}
  .target-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}

@media(max-width:760px){
  #app{display:block;padding:8px}
  .sidebar{position:static;width:100%;height:auto;min-height:0;margin-bottom:8px;border-radius:17px;padding:11px}
  .brand{margin:2px 5px 10px}.brand-mark{width:34px;height:34px}.brand-copy small{display:none}
  .sidebar nav{display:flex;overflow:auto;padding-bottom:2px;gap:5px;scrollbar-width:none}.sidebar nav::-webkit-scrollbar{display:none}
  .nav{width:auto;min-width:max-content;padding:8px 10px}.nav-icon{display:none}
  .sidebar-section{display:none}
  .sidebar-foot{margin-top:10px;padding:9px 4px 0}.workspace-profile{justify-content:space-between}.workspace-user{max-width:calc(100% - 80px)}
  main{padding:15px;border-radius:17px}
  .overview-topbar{align-items:flex-start}.overview-date{display:none}
  .overview-toolbar{grid-template-columns:1fr auto}.overview-toolbar .overview-action:not(.primary){display:none}
  .overview-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.overview-stat{min-height:105px}
  .overview-grid{grid-template-columns:1fr}.overview-stack{grid-template-columns:1fr!important}
  .settings-grid{grid-template-columns:1fr}
  .page-head,.detail-head,.targeting-head,.rd-head,.dq-head,.settings-head{align-items:flex-start;flex-direction:column}
  .page-head h1,.detail-head h1,.targeting-head h1,.rd-head h1,.dq-head h1,.settings-head h1{font-size:25px}
  .target-grid{grid-template-columns:1fr!important}
}
